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
@@ -40,13 +40,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
{
@SideOnly( Side.CLIENT )
public Integer dspList;
private Integer dspList;
@SideOnly( Side.CLIENT )
public boolean updateList;
private boolean updateList;
IAEItemStack dspPlay;
AEColor paintedColor = AEColor.Transparent;
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.Transparent;
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException
@@ -65,7 +65,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.dspPlay = null;
}
this.updateList = true;
this.setUpdateList( true );
return oldPaintedColor != this.paintedColor; // tesr!
}
@@ -159,4 +159,24 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.markForUpdate();
return true;
}
public Integer getDisplayList()
{
return this.dspList;
}
public void setDisplayList( final Integer dspList )
{
this.dspList = dspList;
}
public boolean isUpdateList()
{
return this.updateList;
}
public void setUpdateList( final boolean updateList )
{
this.updateList = updateList;
}
}
@@ -27,7 +27,7 @@ import appeng.block.crafting.BlockCraftingUnit;
public class TileCraftingStorageTile extends TileCraftingTile
{
public static final int KILO_SCALAR = 1024;
private static final int KILO_SCALAR = 1024;
@Override
protected ItemStack getItemFromTile( final Object obj )
@@ -57,17 +57,16 @@ import appeng.util.Platform;
public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState
{
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
public NBTTagCompound previousState = null;
public boolean isCoreBlock = false;
CraftingCPUCluster cluster;
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
private NBTTagCompound previousState = null;
private boolean isCoreBlock = false;
private CraftingCPUCluster cluster;
public TileCraftingTile()
{
this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
@Override
@@ -113,8 +112,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
return false;
}
final BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( this.pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock();
return unit.type == CraftingUnitType.ACCELERATOR;
}
@@ -122,7 +121,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void onReady()
{
super.onReady();
this.gridProxy.setVisualRepresentation( this.getItemFromTile( this ) );
this.getProxy().setVisualRepresentation( this.getItemFromTile( this ) );
this.updateMultiBlock();
}
@@ -152,9 +151,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
final boolean formed = this.isFormed();
boolean power = false;
if( this.gridProxy.isReady() )
if( this.getProxy().isReady() )
{
power = this.gridProxy.isActive();
power = this.getProxy().isActive();
}
final IBlockState current = this.worldObj.getBlockState( this.pos );
@@ -169,11 +168,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( formed )
{
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
}
}
@@ -182,7 +181,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean)this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
}
return this.cluster != null;
}
@@ -190,8 +189,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCraftingTile( final NBTTagCompound data )
{
data.setBoolean( "core", this.isCoreBlock );
if( this.isCoreBlock && this.cluster != null )
data.setBoolean( "core", this.isCoreBlock() );
if( this.isCoreBlock() && this.cluster != null )
{
this.cluster.writeToNBT( data );
}
@@ -200,8 +199,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCraftingTile( final NBTTagCompound data )
{
this.isCoreBlock = data.getBoolean( "core" );
if( this.isCoreBlock )
this.setCoreBlock( data.getBoolean( "core" ) );
if( this.isCoreBlock() )
{
if( this.cluster != null )
{
@@ -209,7 +208,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
else
{
this.previousState = (NBTTagCompound) data.copy();
this.setPreviousState( (NBTTagCompound) data.copy() );
}
}
}
@@ -334,9 +333,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean)this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -344,8 +343,28 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isServer() )
{
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
return this.isPowered() && this.isFormed();
}
public boolean isCoreBlock()
{
return this.isCoreBlock;
}
public void setCoreBlock( final boolean isCoreBlock )
{
this.isCoreBlock = isCoreBlock;
}
public NBTTagCompound getPreviousState()
{
return this.previousState;
}
public void setPreviousState( final NBTTagCompound previousState )
{
this.previousState = previousState;
}
}
@@ -100,12 +100,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.settings = new ConfigManager( this );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.inv.setMaxStackSize( 1 );
this.gridProxy.setIdlePowerUsage( 0.0 );
this.getProxy().setIdlePowerUsage( 0.0 );
this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() );
this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
}
protected int getUpgradeSlots()
private int getUpgradeSlots()
{
return 5;
}
@@ -150,11 +150,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.isAwake )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -554,7 +554,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
try
{
return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
return (int) ( this.getProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
}
catch( final GridAccessException e )
{
@@ -630,7 +630,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
newState = this.getProxy().isActive() && this.getProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch( final GridAccessException ignored )
{
@@ -655,4 +655,5 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
return this.isPowered;
}
}