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
@@ -37,7 +37,7 @@ import appeng.util.Platform;
public abstract class PartSharedItemBus extends PartUpgradeable implements IGridTickable
{
protected final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
private int adaptorHash = 0;
private InventoryAdaptor adaptor;
private boolean lastRedstone = false;
@@ -57,14 +57,14 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
public void readFromNBT( final net.minecraft.nbt.NBTTagCompound extra )
{
super.readFromNBT( extra );
this.config.readFromNBT( extra, "config" );
this.getConfig().readFromNBT( extra, "config" );
}
@Override
public void writeToNBT( final net.minecraft.nbt.NBTTagCompound extra )
{
super.writeToNBT( extra );
this.config.writeToNBT( extra, "config" );
this.getConfig().writeToNBT( extra, "config" );
}
@Override
@@ -72,7 +72,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
{
if( name.equals( "config" ) )
{
return this.config;
return this.getConfig();
}
return super.getInventoryByName( name );
@@ -82,7 +82,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
public void onNeighborChanged()
{
this.updateState();
if( this.lastRedstone != this.host.hasRedstone( this.side ) )
if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) )
{
this.lastRedstone = !this.lastRedstone;
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
@@ -95,7 +95,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
protected InventoryAdaptor getHandler()
{
final TileEntity self = this.getHost().getTile();
final TileEntity target = this.getTileEntity( self, self.getPos().offset( this.side.getFacing() ) );
final TileEntity target = this.getTileEntity( self, self.getPos().offset( this.getSide().getFacing() ) );
final int newAdaptorHash = Platform.generateTileHash( target );
@@ -105,7 +105,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
}
this.adaptorHash = newAdaptorHash;
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getFacing().getOpposite() );
this.adaptor = InventoryAdaptor.getAdaptor( target, this.getSide().getFacing().getOpposite() );
return this.adaptor;
}
@@ -118,13 +118,13 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
{
return w.getTileEntity( pos );
}
return null;
}
protected int availableSlots()
{
return Math.min( 1 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 4, this.config.getSizeInventory() );
return Math.min( 1 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 4, this.getConfig().getSizeInventory() );
}
protected int calculateItemsToSend()
@@ -155,10 +155,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
protected boolean canDoBusWork()
{
final TileEntity self = this.getHost().getTile();
final BlockPos selfPos = self.getPos().offset( this.side.getFacing() );
final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() );
final int xCoordinate = selfPos.getX();
final int zCoordinate = selfPos.getZ();
final World world = self.getWorld();
return world != null && world.getChunkProvider().chunkExists( xCoordinate >> 4, zCoordinate >> 4 );
@@ -170,11 +169,11 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
{
if( !this.isSleeping() )
{
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
else
{
this.proxy.getTick().sleepDevice( this.proxy.getNode() );
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -184,4 +183,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
}
protected abstract TickRateModulation doBusWork();
AppEngInternalAEInventory getConfig()
{
return this.config;
}
}