mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Add functionality in IItemHandler to test if a slot can accept an item (#5033)
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user