Call isStackValidForSlot when inserting.

This commit is contained in:
immibis 2013-05-11 16:55:41 +12:00
parent cede00e162
commit 88f336c799
2 changed files with 4 additions and 4 deletions

View file

@ -63,12 +63,12 @@ public class TransactorSimple extends Transactor {
} }
protected int getEmptySlot(ItemStack stack, ForgeDirection orientation, int slotIndex) { protected int getEmptySlot(ItemStack stack, ForgeDirection orientation, int slotIndex) {
return getEmptySlot(0, inventory.getSizeInventory()); return getEmptySlot(stack, 0, inventory.getSizeInventory());
} }
protected int getEmptySlot(int startSlot, int endSlot) { protected int getEmptySlot(ItemStack stack, int startSlot, int endSlot) {
for (int i = startSlot; i < endSlot; i++) for (int i = startSlot; i < endSlot; i++)
if (inventory.getStackInSlot(i) == null) if (inventory.getStackInSlot(i) == null && inventory.isStackValidForSlot(i, stack))
return i; return i;
return -1; return -1;

View file

@ -32,7 +32,7 @@ public class TransactorVanillaSided extends TransactorSimple {
if (slotIndex >= sideSlots.length) if (slotIndex >= sideSlots.length)
return -1; return -1;
int targetSlot = sideSlots[slotIndex]; int targetSlot = sideSlots[slotIndex];
return sided.canInsertItem(targetSlot, stack, orientation.ordinal()) ? targetSlot : -1; return sided.isStackValidForSlot(targetSlot, stack) && sided.canInsertItem(targetSlot, stack, orientation.ordinal()) ? targetSlot : -1;
} }
} }