mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-05 03:12:38 +01:00
Merge pull request #3122 from StevenDoesStuffs/mc1.16/dev
Fix BasinInventory compatability with ItemHandlerHelper
This commit is contained in:
commit
9ed78993cd
1 changed files with 12 additions and 3 deletions
|
@ -13,16 +13,25 @@ public class BasinInventory extends SmartInventory {
|
|||
super(slots, te, 16, true);
|
||||
this.te = te;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
// 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)))
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
ItemStack extractItem = super.extractItem(slot, amount, simulate);
|
||||
|
|
Loading…
Reference in a new issue