fix blocking mode somehow voiding items

This commit is contained in:
PrototypeTrousers
2022-02-22 19:00:01 -03:00
parent 30f4cdf545
commit b0e81ac2d1
5 changed files with 32 additions and 18 deletions
@@ -232,6 +232,10 @@ public class AdaptorItemHandler extends InventoryAdaptor
for( int slot = 0; slot < this.itemHandler.getSlots(); slot++ )
{
if( !simulate )
{
itemsToAdd = itemsToAdd.copy();
}
itemsToAdd = this.itemHandler.insertItem( slot, itemsToAdd, simulate );
if( itemsToAdd.isEmpty() )
@@ -163,23 +163,26 @@ public class AdaptorItemRepository extends InventoryAdaptor
return this.addItems( toBeAdded, false );
}
protected ItemStack addItems( final ItemStack itemsToAdd, final boolean simulate )
protected ItemStack addItems( ItemStack itemsToAdd, final boolean simulate )
{
if( itemsToAdd.isEmpty() )
{
return ItemStack.EMPTY;
}
ItemStack left = itemsToAdd.copy();
if( !simulate )
{
itemsToAdd = itemsToAdd.copy();
}
left = this.itemRepository.insertItem( left, simulate );
itemsToAdd = this.itemRepository.insertItem( itemsToAdd, simulate );
if( left.isEmpty() )
if( itemsToAdd.isEmpty() )
{
return ItemStack.EMPTY;
}
return left;
return itemsToAdd;
}
@Override
@@ -37,11 +37,10 @@ public class BlockingItemHandler extends BlockingInventoryAdaptor
for( int slot = 0; slot < slots; slot++ )
{
ItemStack is = this.itemHandler.getStackInSlot( slot );
if( is.isEmpty() || !isBlockableItem( is ) )
if( !is.isEmpty() && isBlockableItem( is ) )
{
continue;
return true;
}
return true;
}
return false;
}