only calculate difference when it's the same item

This commit is contained in:
Florian Scandella
2017-08-29 22:52:59 +02:00
parent 90130e72aa
commit 1a918be658
@@ -119,6 +119,8 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
ItemStack added = this.getStackInSlot( slot ).copy(); ItemStack added = this.getStackInSlot( slot ).copy();
ItemStack removed = this.previousStack.copy(); ItemStack removed = this.previousStack.copy();
if( !added.isEmpty() && !removed.isEmpty() && Platform.itemComparisons().isEqualItem( added, removed ) )
{
if( this.currentOp == InvOperation.INSERT ) if( this.currentOp == InvOperation.INSERT )
{ {
added.grow( -removed.getCount() ); added.grow( -removed.getCount() );
@@ -127,6 +129,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
{ {
removed.grow( -added.getCount() ); removed.grow( -added.getCount() );
} }
}
this.getTileEntity().onChangeInventory( this, slot, this.currentOp, removed, added ); this.getTileEntity().onChangeInventory( this, slot, this.currentOp, removed, added );
this.getTileEntity().saveChanges(); this.getTileEntity().saveChanges();
} }