Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void removeItem(EntityPlayer player, ItemStack is, int amount) {
- if(is == null)
- return;
- IInventory inv = player.inventory;
- for(int i = 0; i < inv.getSizeInventory(); i++) {
- if(inv.getStackInSlot(i) != null) {
- ItemStack stack = (ItemStack) inv.getStackInSlot(i);
- if(is.stackSize == 0)
- break;
- if(stack.stackSize == 0)
- inv.removeStackFromSlot(i);
- int mod = Math.min(is.stackSize, stack.stackSize);
- is.stackSize -= mod;
- stack.stackSize -= mod;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement