mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-04 23:53:01 +00:00
Replace direct equality with InventoryUtil.areItemsEqual
Some IItemHandler.insertItem implementations clone the item, so we must check whether the object is equal instead. Fixes #340
This commit is contained in:
@@ -163,13 +163,13 @@ public class InventoryUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inspect the slots in order and try to find empty or stackable slots
|
// Inspect the slots in order and try to find empty or stackable slots
|
||||||
ItemStack remainder = stack;
|
ItemStack remainder = stack.copy();
|
||||||
for( int slot : slots )
|
for( int slot : slots )
|
||||||
{
|
{
|
||||||
if( remainder == null ) break;
|
if( remainder == null ) break;
|
||||||
remainder = inventory.insertItem( slot, remainder, false );
|
remainder = inventory.insertItem( slot, remainder, false );
|
||||||
}
|
}
|
||||||
return remainder;
|
return areItemsEqual( stack, remainder ) ? stack : remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemStack takeItems( int count, IItemHandler inventory, int[] slots )
|
private static ItemStack takeItems( int count, IItemHandler inventory, int[] slots )
|
||||||
|
|||||||
Reference in New Issue
Block a user