Fixes interface shift-clicking to generate correct onChangeInventory events (#3544)

This commit is contained in:
fscan
2018-06-18 19:01:17 +02:00
committed by yueh
parent 2c6e50d48a
commit 0ef854ca4b
@@ -436,6 +436,8 @@ public abstract class AEBaseContainer extends Container
} }
else else
{ {
tis = tis.copy();
// target slots in the container... // target slots in the container...
for( final Object inventorySlot : this.inventorySlots ) for( final Object inventorySlot : this.inventorySlots )
{ {
@@ -496,7 +498,7 @@ public abstract class AEBaseContainer extends Container
{ {
if( d.getHasStack() ) if( d.getHasStack() )
{ {
final ItemStack t = d.getStack(); final ItemStack t = d.getStack().copy();
if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis)) if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis))
{ {
@@ -516,6 +518,8 @@ public abstract class AEBaseContainer extends Container
t.setCount( t.getCount() + placeAble ); t.setCount( t.getCount() + placeAble );
tis.setCount( tis.getCount() - placeAble ); tis.setCount( tis.getCount() - placeAble );
d.putStack( t );
if( tis.getCount() <= 0 ) if( tis.getCount() <= 0 )
{ {
clickSlot.putStack( ItemStack.EMPTY ); clickSlot.putStack( ItemStack.EMPTY );
@@ -548,7 +552,7 @@ public abstract class AEBaseContainer extends Container
{ {
if( d.getHasStack() ) if( d.getHasStack() )
{ {
final ItemStack t = d.getStack(); final ItemStack t = d.getStack().copy();
if( Platform.itemComparisons().isSameItem( t, tis ) ) if( Platform.itemComparisons().isSameItem( t, tis ) )
{ {
@@ -568,6 +572,8 @@ public abstract class AEBaseContainer extends Container
t.setCount( t.getCount() + placeAble ); t.setCount( t.getCount() + placeAble );
tis.setCount( tis.getCount() - placeAble ); tis.setCount( tis.getCount() - placeAble );
d.putStack( t );
if( tis.getCount() <= 0 ) if( tis.getCount() <= 0 )
{ {
clickSlot.putStack( ItemStack.EMPTY ); clickSlot.putStack( ItemStack.EMPTY );
@@ -626,7 +632,7 @@ public abstract class AEBaseContainer extends Container
} }
} }
clickSlot.putStack( !tis.isEmpty() ? tis.copy() : ItemStack.EMPTY ); clickSlot.putStack( !tis.isEmpty() ? tis : ItemStack.EMPTY );
} }
this.updateSlot( clickSlot ); this.updateSlot( clickSlot );