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
+42 -32
View File
@@ -45,23 +45,23 @@ import appeng.util.Platform;
public class CachedPlane
{
final int x_size;
final int z_size;
final int cx_size;
final int cz_size;
final int x_offset;
final int y_offset;
final int z_offset;
final int y_size;
final Chunk[][] myChunks;
final Column[][] myColumns;
final LinkedList<TileEntity> tiles = new LinkedList<TileEntity>();
final LinkedList<NextTickListEntry> ticks = new LinkedList<NextTickListEntry>();
final World world;
final IMovableRegistry reg = AEApi.instance().registries().movable();
final LinkedList<WorldCoord> updates = new LinkedList<WorldCoord>();
private final int x_size;
private final int z_size;
private final int cx_size;
private final int cz_size;
private final int x_offset;
private final int y_offset;
private final int z_offset;
private final int y_size;
private final Chunk[][] myChunks;
private final Column[][] myColumns;
private final LinkedList<TileEntity> tiles = new LinkedList<TileEntity>();
private final LinkedList<NextTickListEntry> ticks = new LinkedList<NextTickListEntry>();
private final World world;
private final IMovableRegistry reg = AEApi.instance().registries().movable();
private final LinkedList<WorldCoord> updates = new LinkedList<WorldCoord>();
private final IBlockDefinition matrixFrame = AEApi.instance().definitions().blocks().matrixFrame();
int verticalBits;
private int verticalBits;
public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ )
{
@@ -152,8 +152,8 @@ public class CachedPlane
c.chunkTileEntityMap.remove( cp );
}
final long k = this.world.getTotalWorldTime();
final List list = this.world.getPendingBlockUpdates( c, false );
final long k = this.getWorld().getTotalWorldTime();
final List list = this.getWorld().getPendingBlockUpdates( c, false );
if( list != null )
{
for( final Object o : list )
@@ -174,7 +174,7 @@ public class CachedPlane
{
try
{
this.world.loadedTileEntityList.remove( te );
this.getWorld().loadedTileEntityList.remove( te );
}
catch( final Exception e )
{
@@ -264,16 +264,16 @@ public class CachedPlane
private void markForUpdate( final int x, final int y, final int z )
{
this.updates.add( new WorldCoord( x, y, z ) );
this.getUpdates().add( new WorldCoord( x, y, z ) );
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
this.updates.add( new WorldCoord( x + d.offsetX, y + d.offsetY, z + d.offsetZ ) );
this.getUpdates().add( new WorldCoord( x + d.offsetX, y + d.offsetY, z + d.offsetZ ) );
}
}
private void addTick( final int x, final int y, final int z, final NextTickListEntry entry )
{
this.world.scheduleBlockUpdate( x + this.x_offset, y + this.y_offset, z + this.z_offset, entry.func_151351_a(), (int) entry.scheduledTime );
this.getWorld().scheduleBlockUpdate( x + this.x_offset, y + this.y_offset, z + this.z_offset, entry.func_151351_a(), (int) entry.scheduledTime );
}
private void addTile( final int x, final int y, final int z, final TileEntity te, final CachedPlane alternateDestination, final IMovableRegistry mr )
@@ -288,14 +288,14 @@ public class CachedPlane
try
{
handler.moveTile( te, this.world, x + this.x_offset, y + this.y_offset, z + this.z_offset );
handler.moveTile( te, this.getWorld(), x + this.x_offset, y + this.y_offset, z + this.z_offset );
}
catch( final Throwable e )
{
AELog.error( e );
// attempt recovery...
te.setWorldObj( this.world );
te.setWorldObj( this.getWorld() );
te.xCoord = x;
te.yCoord = y;
te.zCoord = z;
@@ -305,8 +305,8 @@ public class CachedPlane
if( c.c.isChunkLoaded )
{
this.world.addTileEntity( te );
this.world.markBlockForUpdate( x, y, z );
this.getWorld().addTileEntity( te );
this.getWorld().markBlockForUpdate( x, y, z );
}
}
@@ -348,7 +348,7 @@ public class CachedPlane
for( int y = 1; y < 255; y += 32 )
{
WorldData.instance().compassData().service().updateArea( this.world, c.xPosition << 4, y, c.zPosition << 4 );
WorldData.instance().compassData().service().updateArea( this.getWorld(), c.xPosition << 4, y, c.zPosition << 4 );
}
Platform.sendChunk( c, this.verticalBits );
@@ -356,7 +356,17 @@ public class CachedPlane
}
}
class Column
LinkedList<WorldCoord> getUpdates()
{
return this.updates;
}
World getWorld()
{
return this.world;
}
private class Column
{
private final int x;
@@ -385,7 +395,7 @@ public class CachedPlane
}
}
public void setBlockIDWithMetadata( final int y, final Object[] blk )
private void setBlockIDWithMetadata( final int y, final Object[] blk )
{
for( final Block matrixFrameBlock : CachedPlane.this.matrixFrame.maybeBlock().asSet() )
{
@@ -402,7 +412,7 @@ public class CachedPlane
extendedBlockStorage.setExtBlocklightValue( this.x, y & 15, this.z, (Integer) blk[2] );
}
public Object[] getDetails( final int y )
private Object[] getDetails( final int y )
{
final ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4];
this.ch[0] = extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z );
@@ -411,7 +421,7 @@ public class CachedPlane
return this.ch;
}
public boolean doNotSkip( final int y )
private boolean doNotSkip( final int y )
{
final ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4];
if( CachedPlane.this.reg.isBlacklisted( extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z ) ) )
@@ -422,7 +432,7 @@ public class CachedPlane
return this.skipThese == null || !this.skipThese.contains( y );
}
public void setSkip( final int yCoord )
private void setSkip( final int yCoord )
{
if( this.skipThese == null )
{
@@ -35,7 +35,7 @@ import appeng.core.AEConfig;
public class StorageChunkProvider extends ChunkProviderGenerate
{
public static final int SQUARE_CHUNK_SIZE = 256;
private static final int SQUARE_CHUNK_SIZE = 256;
private static final Block[] BLOCKS;
static
@@ -51,7 +51,7 @@ public class StorageChunkProvider extends ChunkProviderGenerate
}
}
final World world;
private final World world;
public StorageChunkProvider( final World world, final long i )
{
+22 -24
View File
@@ -19,7 +19,6 @@
package appeng.spatial;
import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.block.Block;
@@ -43,7 +42,6 @@ public class StorageHelper
{
private static StorageHelper instance;
Method onEntityRemoved;
public static StorageHelper getInstance()
{
@@ -62,7 +60,7 @@ public class StorageHelper
*
* @return teleported entity
*/
public Entity teleportEntity( Entity entity, final TelDestination link )
private Entity teleportEntity( Entity entity, final TelDestination link )
{
final WorldServer oldWorld;
final WorldServer newWorld;
@@ -177,7 +175,7 @@ public class StorageHelper
return entity;
}
public void transverseEdges( final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ, final ISpatialVisitor visitor )
private void transverseEdges( final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ, final ISpatialVisitor visitor )
{
for( int y = minY; y < maxY; y++ )
{
@@ -239,14 +237,14 @@ public class StorageHelper
this.teleportEntity( e, new TelDestination( dst, dstBox, e.posX, e.posY, e.posZ, -x + i, -y + j, -z + k ) );
}
for( final WorldCoord wc : cDst.updates )
for( final WorldCoord wc : cDst.getUpdates() )
{
cDst.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
cDst.getWorld().notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
}
for( final WorldCoord wc : cSrc.updates )
for( final WorldCoord wc : cSrc.getUpdates() )
{
cSrc.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
cSrc.getWorld().notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
}
this.transverseEdges( x - 1, y - 1, z - 1, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1, new TriggerUpdates( src ) );
@@ -264,10 +262,10 @@ public class StorageHelper
}
static class TriggerUpdates implements ISpatialVisitor
private static class TriggerUpdates implements ISpatialVisitor
{
final World dst;
private final World dst;
public TriggerUpdates( final World dst2 )
{
@@ -282,12 +280,12 @@ public class StorageHelper
}
}
static class WrapInMatrixFrame implements ISpatialVisitor
private static class WrapInMatrixFrame implements ISpatialVisitor
{
final World dst;
final Block blkID;
final int Meta;
private final World dst;
private final Block blkID;
private final int Meta;
public WrapInMatrixFrame( final Block blockID, final int metaData, final World dst2 )
{
@@ -303,16 +301,16 @@ public class StorageHelper
}
}
static class TelDestination
private static class TelDestination
{
final World dim;
final double x;
final double y;
final double z;
final int xOff;
final int yOff;
final int zOff;
private final World dim;
private final double x;
private final double y;
private final double z;
private final int xOff;
private final int yOff;
private final int zOff;
TelDestination( final World dimension, final AxisAlignedBB srcBox, final double x, final double y, final double z, final int tileX, final int tileY, final int tileZ )
{
@@ -326,10 +324,10 @@ public class StorageHelper
}
}
static class METeleporter extends Teleporter
private static class METeleporter extends Teleporter
{
final TelDestination destination;
private final TelDestination destination;
public METeleporter( final WorldServer par1WorldServer, final TelDestination d )
{