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:
@@ -39,7 +39,7 @@ import appeng.tile.crafting.TileCraftingTile;
|
||||
public class CraftingCPUCalculator extends MBCalculator
|
||||
{
|
||||
|
||||
final TileCraftingTile tqb;
|
||||
private final TileCraftingTile tqb;
|
||||
|
||||
public CraftingCPUCalculator( final IAEMultiBlock t )
|
||||
{
|
||||
|
||||
@@ -194,14 +194,14 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return (Iterator) this.tiles.iterator();
|
||||
}
|
||||
|
||||
public void addTile( final TileCraftingTile te )
|
||||
void addTile( final TileCraftingTile te )
|
||||
{
|
||||
if( this.machineSrc == null || te.isCoreBlock )
|
||||
if( this.machineSrc == null || te.isCoreBlock() )
|
||||
{
|
||||
this.machineSrc = new MachineSource( te );
|
||||
}
|
||||
|
||||
te.isCoreBlock = false;
|
||||
te.setCoreBlock( false );
|
||||
te.markDirty();
|
||||
this.tiles.push( te );
|
||||
|
||||
@@ -362,7 +362,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return input;
|
||||
}
|
||||
|
||||
protected void postChange( final IAEItemStack diff, final BaseActionSource src )
|
||||
private void postChange( final IAEItemStack diff, final BaseActionSource src )
|
||||
{
|
||||
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.getListeners();
|
||||
|
||||
@@ -394,7 +394,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
this.getCore().markDirty();
|
||||
}
|
||||
|
||||
public void postCraftingStatusChange( final IAEItemStack diff )
|
||||
private void postCraftingStatusChange( final IAEItemStack diff )
|
||||
{
|
||||
if( this.getGrid() == null )
|
||||
{
|
||||
@@ -403,9 +403,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
|
||||
final CraftingGridCache sg = this.getGrid().getCache( ICraftingGrid.class );
|
||||
|
||||
if( sg.interestManager.containsKey( diff ) )
|
||||
if( sg.getInterestManager().containsKey( diff ) )
|
||||
{
|
||||
final Collection<CraftingWatcher> list = sg.interestManager.get( diff );
|
||||
final Collection<CraftingWatcher> list = sg.getInterestManager().get( diff );
|
||||
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
@@ -448,7 +448,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
}
|
||||
|
||||
protected Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> getListeners()
|
||||
private Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> getListeners()
|
||||
{
|
||||
return this.listeners.entrySet().iterator();
|
||||
}
|
||||
@@ -458,7 +458,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return (TileCraftingTile) this.machineSrc.via;
|
||||
}
|
||||
|
||||
public IGrid getGrid()
|
||||
private IGrid getGrid()
|
||||
{
|
||||
for( final TileCraftingTile r : this.tiles )
|
||||
{
|
||||
@@ -853,7 +853,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
try
|
||||
{
|
||||
this.waitingFor.resetStatus();
|
||||
( (CraftingJob) job ).tree.setJob( ci, this, src );
|
||||
( (CraftingJob) job ).getTree().setJob( ci, this, src );
|
||||
if( ci.commit( src ) )
|
||||
{
|
||||
this.finalOutput = job.getOutput();
|
||||
@@ -1159,16 +1159,16 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return out;
|
||||
}
|
||||
|
||||
public void done()
|
||||
void done()
|
||||
{
|
||||
final TileCraftingTile core = this.getCore();
|
||||
|
||||
core.isCoreBlock = true;
|
||||
core.setCoreBlock( true );
|
||||
|
||||
if( core.previousState != null )
|
||||
if( core.getPreviousState() != null )
|
||||
{
|
||||
this.readFromNBT( core.previousState );
|
||||
core.previousState = null;
|
||||
this.readFromNBT( core.getPreviousState() );
|
||||
core.setPreviousState( null );
|
||||
}
|
||||
|
||||
this.updateCPU();
|
||||
@@ -1328,8 +1328,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return this.startItemCount;
|
||||
}
|
||||
|
||||
static class TaskProgress
|
||||
private static class TaskProgress
|
||||
{
|
||||
long value;
|
||||
private long value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,13 +140,13 @@ public class QuantumCalculator extends MBCalculator
|
||||
{
|
||||
if( num == 1 || num == 3 || num == 7 || num == 9 )
|
||||
{
|
||||
flags = (byte) ( this.tqb.corner | num );
|
||||
flags = (byte) ( this.tqb.getCorner() | num );
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = num;
|
||||
}
|
||||
c.Ring[ringNum] = te;
|
||||
c.getRing()[ringNum] = te;
|
||||
ringNum++;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ import appeng.util.iterators.ChainedIterator;
|
||||
public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
|
||||
public final WorldCoord min;
|
||||
public final WorldCoord max;
|
||||
public boolean isDestroyed = false;
|
||||
public boolean updateStatus = true;
|
||||
public TileQuantumBridge[] Ring;
|
||||
boolean registered = false;
|
||||
ConnectionWrapper connection;
|
||||
private final WorldCoord min;
|
||||
private final WorldCoord max;
|
||||
private boolean isDestroyed = false;
|
||||
private boolean updateStatus = true;
|
||||
private TileQuantumBridge[] Ring;
|
||||
private boolean registered = false;
|
||||
private ConnectionWrapper connection;
|
||||
private long thisSide;
|
||||
private long otherSide;
|
||||
private TileQuantumBridge center;
|
||||
@@ -61,7 +61,7 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.Ring = new TileQuantumBridge[8];
|
||||
this.setRing( new TileQuantumBridge[8] );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -69,7 +69,7 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
if( this.center.getWorld() == e.world )
|
||||
{
|
||||
this.updateStatus = false;
|
||||
this.setUpdateStatus( false );
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
@@ -122,10 +122,10 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
|
||||
if( sideA.isActive() && sideB.isActive() )
|
||||
{
|
||||
if( this.connection != null && this.connection.connection != null )
|
||||
if( this.connection != null && this.connection.getConnection() != null )
|
||||
{
|
||||
final IGridNode a = this.connection.connection.a();
|
||||
final IGridNode b = this.connection.connection.b();
|
||||
final IGridNode a = this.connection.getConnection().a();
|
||||
final IGridNode b = this.connection.getConnection().b();
|
||||
final IGridNode sa = sideA.getNode();
|
||||
final IGridNode sb = sideB.getNode();
|
||||
if( ( a == sa || b == sa ) && ( a == sb || b == sb ) )
|
||||
@@ -138,18 +138,18 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
if( sideA.connection != null )
|
||||
{
|
||||
if( sideA.connection.connection != null )
|
||||
if( sideA.connection.getConnection() != null )
|
||||
{
|
||||
sideA.connection.connection.destroy();
|
||||
sideA.connection.getConnection().destroy();
|
||||
sideA.connection = new ConnectionWrapper( null );
|
||||
}
|
||||
}
|
||||
|
||||
if( sideB.connection != null )
|
||||
{
|
||||
if( sideB.connection.connection != null )
|
||||
if( sideB.connection.getConnection() != null )
|
||||
{
|
||||
sideB.connection.connection.destroy();
|
||||
sideB.connection.getConnection().destroy();
|
||||
sideB.connection = new ConnectionWrapper( null );
|
||||
}
|
||||
}
|
||||
@@ -173,16 +173,16 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
|
||||
if( shutdown && this.connection != null )
|
||||
{
|
||||
if( this.connection.connection != null )
|
||||
if( this.connection.getConnection() != null )
|
||||
{
|
||||
this.connection.connection.destroy();
|
||||
this.connection.connection = null;
|
||||
this.connection.getConnection().destroy();
|
||||
this.connection.setConnection( null );
|
||||
this.connection = new ConnectionWrapper( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canUseNode( final long qe )
|
||||
private boolean canUseNode( final long qe )
|
||||
{
|
||||
final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
|
||||
if( qc != null )
|
||||
@@ -219,7 +219,7 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
return this.center.getGridNode( AEPartLocation.INTERNAL );
|
||||
}
|
||||
|
||||
public boolean hasQES()
|
||||
private boolean hasQES()
|
||||
{
|
||||
return this.thisSide != 0;
|
||||
}
|
||||
@@ -245,26 +245,26 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||
}
|
||||
|
||||
this.center.updateStatus( null, (byte) -1, this.updateStatus );
|
||||
this.center.updateStatus( null, (byte) -1, this.isUpdateStatus() );
|
||||
|
||||
for( final TileQuantumBridge r : this.Ring )
|
||||
for( final TileQuantumBridge r : this.getRing() )
|
||||
{
|
||||
r.updateStatus( null, (byte) -1, this.updateStatus );
|
||||
r.updateStatus( null, (byte) -1, this.isUpdateStatus() );
|
||||
}
|
||||
|
||||
this.center = null;
|
||||
this.Ring = new TileQuantumBridge[8];
|
||||
this.setRing( new TileQuantumBridge[8] );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IGridHost> getTiles()
|
||||
{
|
||||
return new ChainedIterator<IGridHost>( this.Ring[0], this.Ring[1], this.Ring[2], this.Ring[3], this.Ring[4], this.Ring[5], this.Ring[6], this.Ring[7], this.center );
|
||||
return new ChainedIterator<IGridHost>( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this.getRing()[5], this.getRing()[6], this.getRing()[7], this.center );
|
||||
}
|
||||
|
||||
public boolean isCorner( final TileQuantumBridge tileQuantumBridge )
|
||||
{
|
||||
return this.Ring[0] == tileQuantumBridge || this.Ring[2] == tileQuantumBridge || this.Ring[4] == tileQuantumBridge || this.Ring[6] == tileQuantumBridge;
|
||||
return this.getRing()[0] == tileQuantumBridge || this.getRing()[2] == tileQuantumBridge || this.getRing()[4] == tileQuantumBridge || this.getRing()[6] == tileQuantumBridge;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -278,10 +278,30 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
return this.center;
|
||||
}
|
||||
|
||||
public void setCenter( final TileQuantumBridge c )
|
||||
void setCenter( final TileQuantumBridge c )
|
||||
{
|
||||
this.registered = true;
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
this.center = c;
|
||||
}
|
||||
|
||||
private boolean isUpdateStatus()
|
||||
{
|
||||
return this.updateStatus;
|
||||
}
|
||||
|
||||
public void setUpdateStatus( final boolean updateStatus )
|
||||
{
|
||||
this.updateStatus = updateStatus;
|
||||
}
|
||||
|
||||
TileQuantumBridge[] getRing()
|
||||
{
|
||||
return this.Ring;
|
||||
}
|
||||
|
||||
private void setRing( final TileQuantumBridge[] ring )
|
||||
{
|
||||
this.Ring = ring;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SpatialPylonCalculator extends MBCalculator
|
||||
{
|
||||
final TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( new BlockPos( x, y, z ) );
|
||||
te.updateStatus( c );
|
||||
c.line.add( ( te ) );
|
||||
c.getLine().add( ( te ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,43 +32,41 @@ import appeng.tile.spatial.TileSpatialPylon;
|
||||
public class SpatialPylonCluster implements IAECluster
|
||||
{
|
||||
|
||||
public final DimensionalCoord min;
|
||||
public final DimensionalCoord max;
|
||||
final List<TileSpatialPylon> line = new ArrayList<TileSpatialPylon>();
|
||||
public boolean isDestroyed = false;
|
||||
private final DimensionalCoord min;
|
||||
private final DimensionalCoord max;
|
||||
private final List<TileSpatialPylon> line = new ArrayList<TileSpatialPylon>();
|
||||
private boolean isDestroyed = false;
|
||||
|
||||
public Axis currentAxis = Axis.UNFORMED;
|
||||
public boolean isValid;
|
||||
public boolean hasPower;
|
||||
public boolean hasChannel;
|
||||
private Axis currentAxis = Axis.UNFORMED;
|
||||
private boolean isValid;
|
||||
|
||||
public SpatialPylonCluster( final DimensionalCoord min, final DimensionalCoord max )
|
||||
{
|
||||
this.min = min.copy();
|
||||
this.max = max.copy();
|
||||
|
||||
if( this.min.x != this.max.x )
|
||||
if( this.getMin().x != this.getMax().x )
|
||||
{
|
||||
this.currentAxis = Axis.X;
|
||||
this.setCurrentAxis( Axis.X );
|
||||
}
|
||||
else if( this.min.y != this.max.y )
|
||||
else if( this.getMin().y != this.getMax().y )
|
||||
{
|
||||
this.currentAxis = Axis.Y;
|
||||
this.setCurrentAxis( Axis.Y );
|
||||
}
|
||||
else if( this.min.z != this.max.z )
|
||||
else if( this.getMin().z != this.getMax().z )
|
||||
{
|
||||
this.currentAxis = Axis.Z;
|
||||
this.setCurrentAxis( Axis.Z );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentAxis = Axis.UNFORMED;
|
||||
this.setCurrentAxis( Axis.UNFORMED );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus( final boolean updateGrid )
|
||||
{
|
||||
for( final TileSpatialPylon r : this.line )
|
||||
for( final TileSpatialPylon r : this.getLine() )
|
||||
{
|
||||
r.recalculateDisplay();
|
||||
}
|
||||
@@ -84,7 +82,7 @@ public class SpatialPylonCluster implements IAECluster
|
||||
}
|
||||
this.isDestroyed = true;
|
||||
|
||||
for( final TileSpatialPylon r : this.line )
|
||||
for( final TileSpatialPylon r : this.getLine() )
|
||||
{
|
||||
r.updateStatus( null );
|
||||
}
|
||||
@@ -93,12 +91,47 @@ public class SpatialPylonCluster implements IAECluster
|
||||
@Override
|
||||
public Iterator<IGridHost> getTiles()
|
||||
{
|
||||
return (Iterator) this.line.iterator();
|
||||
return (Iterator) this.getLine().iterator();
|
||||
}
|
||||
|
||||
public int tileCount()
|
||||
{
|
||||
return this.line.size();
|
||||
return this.getLine().size();
|
||||
}
|
||||
|
||||
public Axis getCurrentAxis()
|
||||
{
|
||||
return this.currentAxis;
|
||||
}
|
||||
|
||||
private void setCurrentAxis( final Axis currentAxis )
|
||||
{
|
||||
this.currentAxis = currentAxis;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
public void setValid( final boolean isValid )
|
||||
{
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
public DimensionalCoord getMax()
|
||||
{
|
||||
return this.max;
|
||||
}
|
||||
|
||||
public DimensionalCoord getMin()
|
||||
{
|
||||
return this.min;
|
||||
}
|
||||
|
||||
List<TileSpatialPylon> getLine()
|
||||
{
|
||||
return this.line;
|
||||
}
|
||||
|
||||
public enum Axis
|
||||
|
||||
Reference in New Issue
Block a user