Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
@@ -35,15 +35,15 @@ import appeng.util.iterators.InvIterator;
public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
protected final int size;
protected final ItemStack[] inv;
public boolean enableClientEvents = false;
protected IAEAppEngInventory te;
protected int maxStack;
private final int size;
private final ItemStack[] inv;
private boolean enableClientEvents = false;
private IAEAppEngInventory te;
private int maxStack;
public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size )
{
this.te = inventory;
this.setTileEntity( inventory );
this.size = size;
this.maxStack = 64;
this.inv = new ItemStack[size];
@@ -96,9 +96,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
ns = split.splitStack( qty );
}
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
}
this.markDirty();
@@ -110,7 +110,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
protected boolean eventsEnabled()
{
return Platform.isServer() || this.enableClientEvents;
return Platform.isServer() || this.isEnableClientEvents();
}
@Override
@@ -125,7 +125,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
final ItemStack oldStack = this.inv[slot];
this.inv[slot] = newItemStack;
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
ItemStack removed = oldStack;
ItemStack added = newItemStack;
@@ -150,7 +150,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
}
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.markDirty();
}
@@ -177,9 +177,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void markDirty()
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
}
}
@@ -203,9 +203,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
// for guis...
public void markDirty( final int slotIndex )
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
}
}
@@ -216,7 +216,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
data.setTag( name, c );
}
public void writeToNBT( final NBTTagCompound target )
private void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -282,14 +282,14 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void openInventory(
final EntityPlayer player )
{
}
@Override
public void closeInventory(
final EntityPlayer player )
{
}
@Override
@@ -303,7 +303,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void setField(
final int id,
final int value )
{
{
}
@Override
@@ -317,7 +317,27 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
for( int x = 0; x < this.size; x++ )
{
this.setInventorySlotContents( x,null );
this.setInventorySlotContents( x, null );
}
}
private boolean isEnableClientEvents()
{
return this.enableClientEvents;
}
public void setEnableClientEvents( final boolean enableClientEvents )
{
this.enableClientEvents = enableClientEvents;
}
private IAEAppEngInventory getTileEntity()
{
return this.te;
}
public void setTileEntity( final IAEAppEngInventory te )
{
this.te = te;
}
}