optimize canInsertItem

This commit is contained in:
Matthias Mann committed 2015-05-24 13:39:53 +02:00
1 parent e55d742059
commit 8b9cd4a05e
2 files changed
+10 -17

No files matched your search

@@ -643,11 +643,18 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
}
@Override
public boolean canInsertItem(int slot, ItemStack var2, int side) {
if(isSideDisabled(side)) {
public boolean canInsertItem(int slot, ItemStack itemstack, int side) {
if(isSideDisabled(side) || !slotDefinition.isInputSlot(slot)) {
return false;
}
return slotDefinition.isInputSlot(slot) && isMachineItemValidForSlot(slot, var2);
ItemStack existing = inventory[slot];
if(existing != null) {
// no point in checking the recipes if an item is already in the slot
// worst case we get more of the wrong item - but that doesn't change anything
return existing.isStackable() && existing.isItemEqual(itemstack);
}
// no need to call isItemValidForSlot as upgrade slots are not input slots
return isMachineItemValidForSlot(slot, itemstack);
}
@Override