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:
@@ -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 )
|
||||
{
|
||||
@@ -121,9 +121,9 @@ public class CachedPlane
|
||||
{
|
||||
final BlockPos cp = tx.getKey();
|
||||
final TileEntity te = tx.getValue();
|
||||
|
||||
|
||||
final BlockPos tePOS = te.getPos();
|
||||
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
|
||||
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
|
||||
{
|
||||
if( mr.askToMove( te ) )
|
||||
{
|
||||
@@ -153,15 +153,15 @@ public class CachedPlane
|
||||
c.getTileEntityMap().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 )
|
||||
{
|
||||
final NextTickListEntry entry = (NextTickListEntry) o;
|
||||
final BlockPos tePOS = entry.position;
|
||||
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
|
||||
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
|
||||
{
|
||||
final NextTickListEntry newEntry = new NextTickListEntry( tePOS, entry.getBlock() );
|
||||
newEntry.scheduledTime = entry.scheduledTime - k;
|
||||
@@ -176,7 +176,7 @@ public class CachedPlane
|
||||
{
|
||||
try
|
||||
{
|
||||
this.world.loadedTileEntityList.remove( te );
|
||||
this.getWorld().loadedTileEntityList.remove( te );
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
@@ -300,8 +300,8 @@ public class CachedPlane
|
||||
{
|
||||
AELog.error( e );
|
||||
|
||||
final BlockPos pos = new BlockPos( x,y,z);
|
||||
|
||||
final BlockPos pos = new BlockPos( x, y, z );
|
||||
|
||||
// attempt recovery...
|
||||
te.setWorldObj( this.world );
|
||||
te.setPos( pos );
|
||||
@@ -353,7 +353,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 );
|
||||
@@ -361,7 +361,17 @@ public class CachedPlane
|
||||
}
|
||||
}
|
||||
|
||||
class Column
|
||||
LinkedList<WorldCoord> getUpdates()
|
||||
{
|
||||
return this.updates;
|
||||
}
|
||||
|
||||
World getWorld()
|
||||
{
|
||||
return this.world;
|
||||
}
|
||||
|
||||
private class Column
|
||||
{
|
||||
|
||||
private final int x;
|
||||
@@ -390,7 +400,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() )
|
||||
{
|
||||
@@ -406,7 +416,7 @@ public class CachedPlane
|
||||
extendedBlockStorage.setExtBlocklightValue( this.x, y & 15, this.z, (Integer) blk[1] );
|
||||
}
|
||||
|
||||
public Object[] getDetails( final int y )
|
||||
private Object[] getDetails( final int y )
|
||||
{
|
||||
final ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4];
|
||||
this.ch[0] = extendedblockstorage.get( this.x, y & 15, this.z );
|
||||
@@ -414,7 +424,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 ) ) )
|
||||
@@ -425,7 +435,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 )
|
||||
{
|
||||
|
||||
@@ -36,7 +36,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
|
||||
@@ -52,7 +52,7 @@ public class StorageChunkProvider extends ChunkProviderGenerate
|
||||
}
|
||||
}
|
||||
|
||||
final World world;
|
||||
private final World world;
|
||||
|
||||
public StorageChunkProvider( final World world, final long i )
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -34,6 +33,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.Teleporter;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.stats.Achievements;
|
||||
@@ -44,7 +44,6 @@ public class StorageHelper
|
||||
{
|
||||
|
||||
private static StorageHelper instance;
|
||||
Method onEntityRemoved;
|
||||
|
||||
public static StorageHelper getInstance()
|
||||
{
|
||||
@@ -59,11 +58,11 @@ public class StorageHelper
|
||||
* Mostly from dimensional doors.. which mostly got it form X-Comp.
|
||||
*
|
||||
* @param entity to be teleported entity
|
||||
* @param link destination
|
||||
* @param link destination
|
||||
*
|
||||
* @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;
|
||||
@@ -176,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++ )
|
||||
{
|
||||
@@ -206,7 +205,9 @@ public class StorageHelper
|
||||
}
|
||||
}
|
||||
|
||||
public void swapRegions( final World src /** over world **/, final World dst /** storage cell **/, final int x, final int y, final int z, final int i, final int j, final int k, final int scaleX, final int scaleY, final int scaleZ )
|
||||
public void swapRegions( final World src /** over world **/
|
||||
, final World dst /** storage cell **/
|
||||
, final int x, final int y, final int z, final int i, final int j, final int k, final int scaleX, final int scaleY, final int scaleZ )
|
||||
{
|
||||
for( final Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() )
|
||||
{
|
||||
@@ -236,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() )
|
||||
{
|
||||
cSrc.world.notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK );
|
||||
cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK );
|
||||
}
|
||||
|
||||
for( final WorldCoord wc : cSrc.updates )
|
||||
for( final WorldCoord wc : cSrc.getUpdates() )
|
||||
{
|
||||
cSrc.world.notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK );
|
||||
cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK );
|
||||
}
|
||||
|
||||
this.transverseEdges( x - 1, y - 1, z - 1, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1, new TriggerUpdates( src ) );
|
||||
@@ -253,18 +254,18 @@ public class StorageHelper
|
||||
this.transverseEdges( i, j, k, i + scaleX, j + scaleY, k + scaleZ, new TriggerUpdates( dst ) );
|
||||
|
||||
/*
|
||||
* IChunkProvider cp = destination.getChunkProvider(); if ( cp instanceof ChunkProviderServer ) { ChunkProviderServer
|
||||
* IChunkProvider cp = destination.getChunkProvider(); if ( cp instanceof ChunkProviderServer ) {
|
||||
* ChunkProviderServer
|
||||
* srv = (ChunkProviderServer) cp; srv.unloadAllChunks(); }
|
||||
*
|
||||
* cp.unloadQueuedChunks();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
static class TriggerUpdates implements ISpatialVisitor
|
||||
private static class TriggerUpdates implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
private final World dst;
|
||||
|
||||
public TriggerUpdates( final World dst2 )
|
||||
{
|
||||
@@ -275,16 +276,15 @@ public class StorageHelper
|
||||
public void visit( final BlockPos pos )
|
||||
{
|
||||
final Block blk = this.dst.getBlockState( pos ).getBlock();
|
||||
blk.onNeighborBlockChange( this.dst, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK);
|
||||
blk.onNeighborBlockChange( this.dst, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class WrapInMatrixFrame implements ISpatialVisitor
|
||||
private static class WrapInMatrixFrame implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
final IBlockState state;
|
||||
private final World dst;
|
||||
private final IBlockState state;
|
||||
|
||||
public WrapInMatrixFrame( final IBlockState state, final World dst2 )
|
||||
{
|
||||
@@ -299,17 +299,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 )
|
||||
{
|
||||
@@ -323,11 +322,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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user