More Expendable.

This commit is contained in:
AlgorithmX2 2013-12-29 23:58:08 -06:00
parent 422c91d03a
commit 5a89b97099

View file

@ -15,8 +15,8 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{ {
protected IAEAppEngInventory te; protected IAEAppEngInventory te;
int size; protected int size;
int maxStack; protected int maxStack;
protected ItemStack inv[]; protected ItemStack inv[];
@ -40,6 +40,11 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
inv = new ItemStack[s]; inv = new ItemStack[s];
} }
protected boolean eventsEnabled()
{
return Platform.isServer();
}
public void setMaxStackSize(int s) public void setMaxStackSize(int s)
{ {
maxStack = s; maxStack = s;
@ -67,7 +72,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
else else
ns = split.splitStack( qty ); ns = split.splitStack( qty );
if ( te != null && Platform.isServer() ) if ( te != null && eventsEnabled() )
{ {
te.onChangeInventory( this, slot, InvOperation.decrStackSize, ns, null ); te.onChangeInventory( this, slot, InvOperation.decrStackSize, ns, null );
} }
@ -90,7 +95,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
ItemStack oldStack = inv[slot]; ItemStack oldStack = inv[slot];
inv[slot] = newItemStack; inv[slot] = newItemStack;
if ( te != null && Platform.isServer() ) if ( te != null && eventsEnabled() )
{ {
ItemStack removed = oldStack; ItemStack removed = oldStack;
ItemStack added = newItemStack; ItemStack added = newItemStack;
@ -122,7 +127,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override @Override
public void onInventoryChanged() public void onInventoryChanged()
{ {
if ( te != null && Platform.isServer() ) if ( te != null && eventsEnabled() )
{ {
te.onChangeInventory( this, -1, InvOperation.onInventoryChanged, null, null ); te.onChangeInventory( this, -1, InvOperation.onInventoryChanged, null, null );
} }