Call isStackValidForSlot when inserting.
This commit is contained in:
parent
cede00e162
commit
88f336c799
2 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue