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 1ea48fb389
commit 500fc47490
463 changed files with 5670 additions and 3757 deletions
@@ -54,25 +54,23 @@ import appeng.util.Platform;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
private static final IBlockDefinition RING_DEFINITION = AEApi.instance().definitions().blocks().quantumRing();
public final byte corner = 16;
final int[] sidesRing = {};
final int[] sidesLink = { 0 };
final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
final byte hasSingularity = 32;
final byte powered = 64;
private final byte corner = 16;
private final int[] sidesRing = {};
private final int[] sidesLink = { 0 };
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
private final byte hasSingularity = 32;
private final byte powered = 64;
private final QuantumCalculator calc = new QuantumCalculator( this );
public boolean bridgePowered;
byte constructed = -1;
QuantumCluster cluster;
private byte constructed = -1;
private QuantumCluster cluster;
private boolean updateStatus = false;
public TileQuantumBridge()
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
this.gridProxy.setIdlePowerUsage( 22 );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setFlags( GridFlags.DENSE_CAPACITY );
this.getGridProxy().setIdlePowerUsage( 22 );
this.internalInventory.setMaxStackSize( 1 );
}
@@ -100,7 +98,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
out |= this.hasSingularity;
}
if( this.gridProxy.isActive() && this.constructed != -1 )
if( this.getGridProxy().isActive() && this.constructed != -1 )
{
out |= this.powered;
}
@@ -113,7 +111,6 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final int oldValue = this.constructed;
this.constructed = data.readByte();
this.bridgePowered = ( this.constructed | this.powered ) == this.powered;
return this.constructed != oldValue;
}
@@ -142,7 +139,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
return this.sidesRing;
}
public boolean isCenter()
private boolean isCenter()
{
for( final Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() )
{
@@ -180,7 +177,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final ItemStack linkStack = maybeLinkStack.get();
this.gridProxy.setVisualRepresentation( linkStack );
this.getGridProxy().setVisualRepresentation( linkStack );
}
}
@@ -198,7 +195,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
if( !affectWorld )
{
this.cluster.updateStatus = false;
this.cluster.setUpdateStatus( false );
}
this.cluster.destroy();
@@ -208,7 +205,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( affectWorld )
{
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
}
}
@@ -238,18 +235,18 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( this.isCorner() || this.isCenter() )
{
this.gridProxy.setValidSides( this.getConnections() );
this.getGridProxy().setValidSides( this.getConnections() );
}
else
{
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
this.getGridProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) );
}
}
}
public boolean isCorner()
{
return ( this.constructed & this.corner ) == this.corner && this.constructed != -1;
return ( this.constructed & this.getCorner() ) == this.getCorner() && this.constructed != -1;
}
public EnumSet<ForgeDirection> getConnections()
@@ -291,7 +288,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
try
{
return this.gridProxy.getEnergy().isNetworkPowered();
return this.getGridProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException e )
{
@@ -339,4 +336,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
this.cluster.destroy();
}
}
public byte getCorner()
{
return this.corner;
}
}