Fix NetworkToolViewer stack overflow, saveguard against markDirty recursion.

fixes #3199
This commit is contained in:
Florian Scandella
2017-11-08 13:17:34 +01:00
parent be65edbd5b
commit 56a5363528
3 changed files with 14 additions and 4 deletions
@@ -46,6 +46,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
private final IAEItemStack[] inv;
private final int size;
private int maxStack;
private boolean dirtyFlag = false;
public AppEngInternalAEInventory( final IAEAppEngInventory te, final int s )
{
@@ -252,8 +253,10 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
{
if( this.te != null && Platform.isServer() )
{
this.dirtyFlag = true;
this.te.onChangeInventory( this, slot, op, removed, inserted );
this.te.saveChanges();
this.dirtyFlag = false;
}
}
@@ -283,6 +286,9 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
@Override
public void markDirty( int slot )
{
this.fireOnChangeInventory( slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
if( !this.dirtyFlag )
{
this.fireOnChangeInventory( slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
}
}
}