Add functionality in IItemHandler to test if a slot can accept an item (#5033)

This commit is contained in:
Cody Brittain authored and LexManos committed 2018-07-28 17:38:18 -07:00
1 parent eb870bc84c
commit 4acfca27f8
10 files changed
+105 -28

No files matched your search

@@ -46,24 +46,7 @@ public class SlotItemHandler extends Slot
if (stack.isEmpty())
return false;
IItemHandler handler = this.getItemHandler();
ItemStack remainder;
if (handler instanceof IItemHandlerModifiable)
{
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
remainder = handlerModifiable.insertItem(index, stack, true);
handlerModifiable.setStackInSlot(index, currentStack);
}
else
{
remainder = handler.insertItem(index, stack, true);
}
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
return itemHandler.isItemValid(index, stack);
}
@Override