mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-13 05:54:17 +01:00
Fix BasinInventory compatability with ItemHandlerHelper
This commit is contained in:
parent
e28d01c02c
commit
3f1ee4b872
@ -17,9 +17,18 @@ public class BasinInventory extends SmartInventory {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||||
// Only insert if no other slot already has a stack of this item
|
// Only insert if no other slot already has a stack of this item
|
||||||
for (int i = 0; i < getSlots(); i++)
|
int firstEmpty = -1;
|
||||||
|
for (int i = 0; i < getSlots(); i++) {
|
||||||
if (i != slot && ItemHandlerHelper.canItemStacksStack(stack, inv.getStackInSlot(i)))
|
if (i != slot && ItemHandlerHelper.canItemStacksStack(stack, inv.getStackInSlot(i)))
|
||||||
return stack;
|
return stack;
|
||||||
|
|
||||||
|
if (inv.getStackInSlot(i).isEmpty() && firstEmpty == -1)
|
||||||
|
firstEmpty = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inv.getStackInSlot(slot).isEmpty() && slot != firstEmpty)
|
||||||
|
return stack;
|
||||||
|
|
||||||
return super.insertItem(slot, stack, simulate);
|
return super.insertItem(slot, stack, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user