Created
July 7, 2013 18:49
-
-
Save riking/5944498 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get the inventory in this view that contains the given slot. | |
* @param rawSlot a raw slot number | |
* @return the inventory with that slot number, or null if not applicable | |
*/ | |
public final Inventory getInventoryWithSlot(int rawSlot) { | |
int numInTop = getTopInventory().getSize(); | |
if (rawSlot < 0) { | |
return null; | |
} else if (rawSlot < numInTop) { | |
return getTopInventory(); | |
} else if (rawSlot < numInTop + getBottomInventory().getSize()) { | |
return getBottomInventory(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment