Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,12 +18,15 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
|
||||
public class BiomeGenStorage extends BiomeGenBase
|
||||
{
|
||||
|
||||
public BiomeGenStorage(int id) {
|
||||
public BiomeGenStorage( int id )
|
||||
{
|
||||
super( id );
|
||||
this.setBiomeName( "Storage Cell" );
|
||||
|
||||
@@ -39,5 +42,4 @@ public class BiomeGenStorage extends BiomeGenBase
|
||||
this.spawnableWaterCreatureList.clear();
|
||||
this.spawnableCaveCreatureList.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,21 +91,21 @@ public class CachedPlane
|
||||
this.myColumns = new Column[this.x_size][this.z_size];
|
||||
|
||||
this.verticalBits = 0;
|
||||
for ( int cy = 0; cy < cy_size; cy++ )
|
||||
for( int cy = 0; cy < cy_size; cy++ )
|
||||
{
|
||||
this.verticalBits |= 1 << ( minCY + cy );
|
||||
}
|
||||
|
||||
for ( int x = 0; x < this.x_size; x++ )
|
||||
for ( int z = 0; z < this.z_size; z++ )
|
||||
for( int x = 0; x < this.x_size; x++ )
|
||||
for( int z = 0; z < this.z_size; z++ )
|
||||
{
|
||||
this.myColumns[x][z] = new Column( w.getChunkFromChunkCoords( ( minX + x ) >> 4, ( minZ + z ) >> 4 ), ( minX + x ) & 0xF, ( minZ + z ) & 0xF, minCY, cy_size );
|
||||
}
|
||||
|
||||
IMovableRegistry mr = AEApi.instance().registries().movable();
|
||||
|
||||
for ( int cx = 0; cx < this.cx_size; cx++ )
|
||||
for ( int cz = 0; cz < this.cz_size; cz++ )
|
||||
for( int cx = 0; cx < this.cx_size; cx++ )
|
||||
for( int cz = 0; cz < this.cz_size; cz++ )
|
||||
{
|
||||
LinkedList<Entry<ChunkPosition, TileEntity>> rawTiles = new LinkedList<Entry<ChunkPosition, TileEntity>>();
|
||||
LinkedList<ChunkPosition> deadTiles = new LinkedList<ChunkPosition>();
|
||||
@@ -114,13 +114,13 @@ public class CachedPlane
|
||||
this.myChunks[cx][cz] = c;
|
||||
|
||||
rawTiles.addAll( ( (HashMap<ChunkPosition, TileEntity>) c.chunkTileEntityMap ).entrySet() );
|
||||
for ( Entry<ChunkPosition, TileEntity> tx : rawTiles )
|
||||
for( Entry<ChunkPosition, TileEntity> tx : rawTiles )
|
||||
{
|
||||
ChunkPosition cp = tx.getKey();
|
||||
TileEntity te = tx.getValue();
|
||||
if ( te.xCoord >= minX && te.xCoord <= maxX && te.yCoord >= minY && te.yCoord <= maxY && te.zCoord >= minZ && te.zCoord <= maxZ )
|
||||
if( te.xCoord >= minX && te.xCoord <= maxX && te.yCoord >= minY && te.yCoord <= maxY && te.zCoord >= minZ && te.zCoord <= maxZ )
|
||||
{
|
||||
if ( mr.askToMove( te ) )
|
||||
if( mr.askToMove( te ) )
|
||||
{
|
||||
this.tiles.add( te );
|
||||
deadTiles.add( cp );
|
||||
@@ -131,7 +131,7 @@ public class CachedPlane
|
||||
Block blk = (Block) details[0];
|
||||
|
||||
// don't skip air, just let the code replace it...
|
||||
if ( blk != null && blk.isAir( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) && blk.isReplaceable( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) )
|
||||
if( blk != null && blk.isAir( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) && blk.isReplaceable( c.worldObj, te.xCoord, te.yCoord, te.zCoord ) )
|
||||
{
|
||||
c.worldObj.setBlock( te.xCoord, te.yCoord, te.zCoord, Platform.AIR );
|
||||
c.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.AIR );
|
||||
@@ -142,19 +142,19 @@ public class CachedPlane
|
||||
}
|
||||
}
|
||||
|
||||
for ( ChunkPosition cp : deadTiles )
|
||||
for( ChunkPosition cp : deadTiles )
|
||||
{
|
||||
c.chunkTileEntityMap.remove( cp );
|
||||
}
|
||||
|
||||
long k = this.world.getTotalWorldTime();
|
||||
List list = this.world.getPendingBlockUpdates( c, false );
|
||||
if ( list != null )
|
||||
if( list != null )
|
||||
{
|
||||
for ( Object o : list )
|
||||
for( Object o : list )
|
||||
{
|
||||
NextTickListEntry entry = (NextTickListEntry) o;
|
||||
if ( entry.xCoord >= minX && entry.xCoord <= maxX && entry.yCoord >= minY && entry.yCoord <= maxY && entry.zCoord >= minZ && entry.zCoord <= maxZ )
|
||||
if( entry.xCoord >= minX && entry.xCoord <= maxX && entry.yCoord >= minY && entry.yCoord <= maxY && entry.zCoord >= minZ && entry.zCoord <= maxZ )
|
||||
{
|
||||
NextTickListEntry newEntry = new NextTickListEntry( entry.xCoord, entry.yCoord, entry.zCoord, entry.func_151351_a() );
|
||||
newEntry.scheduledTime = entry.scheduledTime - k;
|
||||
@@ -164,13 +164,13 @@ public class CachedPlane
|
||||
}
|
||||
}
|
||||
|
||||
for ( TileEntity te : this.tiles )
|
||||
for( TileEntity te : this.tiles )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.world.loadedTileEntityList.remove( te );
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
@@ -187,25 +187,25 @@ public class CachedPlane
|
||||
{
|
||||
IMovableRegistry mr = AEApi.instance().registries().movable();
|
||||
|
||||
if ( dst.x_size == this.x_size && dst.y_size == this.y_size && dst.z_size == this.z_size )
|
||||
if( dst.x_size == this.x_size && dst.y_size == this.y_size && dst.z_size == this.z_size )
|
||||
{
|
||||
AELog.info( "Block Copy Scale: " + this.x_size + ", " + this.y_size + ", " + this.z_size );
|
||||
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
for ( int x = 0; x < this.x_size; x++ )
|
||||
for( int x = 0; x < this.x_size; x++ )
|
||||
{
|
||||
for ( int z = 0; z < this.z_size; z++ )
|
||||
for( int z = 0; z < this.z_size; z++ )
|
||||
{
|
||||
Column a = this.myColumns[x][z];
|
||||
Column b = dst.myColumns[x][z];
|
||||
|
||||
for ( int y = 0; y < this.y_size; y++ )
|
||||
for( int y = 0; y < this.y_size; y++ )
|
||||
{
|
||||
int src_y = y + this.y_offset;
|
||||
int dst_y = y + dst.y_offset;
|
||||
|
||||
if ( a.doNotSkip( src_y ) && b.doNotSkip( dst_y ) )
|
||||
if( a.doNotSkip( src_y ) && b.doNotSkip( dst_y ) )
|
||||
{
|
||||
Object[] aD = a.getDetails( src_y );
|
||||
Object[] bD = b.getDetails( dst_y );
|
||||
@@ -226,22 +226,22 @@ public class CachedPlane
|
||||
long duration = endTime - startTime;
|
||||
AELog.info( "Block Copy Time: " + duration );
|
||||
|
||||
for ( TileEntity te : this.tiles )
|
||||
for( TileEntity te : this.tiles )
|
||||
{
|
||||
dst.addTile( te.xCoord - this.x_offset, te.yCoord - this.y_offset, te.zCoord - this.z_offset, te, this, mr );
|
||||
}
|
||||
|
||||
for ( TileEntity te : dst.tiles )
|
||||
for( TileEntity te : dst.tiles )
|
||||
{
|
||||
this.addTile( te.xCoord - dst.x_offset, te.yCoord - dst.y_offset, te.zCoord - dst.z_offset, te, dst, mr );
|
||||
}
|
||||
|
||||
for ( NextTickListEntry entry : this.ticks )
|
||||
for( NextTickListEntry entry : this.ticks )
|
||||
{
|
||||
dst.addTick( entry.xCoord - this.x_offset, entry.yCoord - this.y_offset, entry.zCoord - this.z_offset, entry );
|
||||
}
|
||||
|
||||
for ( NextTickListEntry entry : dst.ticks )
|
||||
for( NextTickListEntry entry : dst.ticks )
|
||||
{
|
||||
this.addTick( entry.xCoord - dst.x_offset, entry.yCoord - dst.y_offset, entry.zCoord - dst.z_offset, entry );
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class CachedPlane
|
||||
private void markForUpdate( int src_x, int src_y, int src_z )
|
||||
{
|
||||
this.updates.add( new WorldCoord( src_x, src_y, src_z ) );
|
||||
for ( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
this.updates.add( new WorldCoord( src_x + d.offsetX, src_y + d.offsetY, src_z + d.offsetZ ) );
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public class CachedPlane
|
||||
{
|
||||
Column c = this.myColumns[x][z];
|
||||
|
||||
if ( c.doNotSkip( y + this.y_offset ) || alternateDestination == null )
|
||||
if( c.doNotSkip( y + this.y_offset ) || alternateDestination == null )
|
||||
{
|
||||
IMovableHandler handler = this.getHandler( te );
|
||||
|
||||
@@ -282,7 +282,7 @@ public class CachedPlane
|
||||
{
|
||||
handler.moveTile( te, this.world, x + this.x_offset, y + this.y_offset, z + this.z_offset );
|
||||
}
|
||||
catch ( Throwable e )
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
|
||||
@@ -295,7 +295,7 @@ public class CachedPlane
|
||||
c.c.func_150812_a( c.x, y + y, c.z, te );
|
||||
// c.c.setChunkTileEntity( c.x, y + y, c.z, te );
|
||||
|
||||
if ( c.c.isChunkLoaded )
|
||||
if( c.c.isChunkLoaded )
|
||||
{
|
||||
this.world.addTileEntity( te );
|
||||
this.world.markBlockForUpdate( x, y, z );
|
||||
@@ -309,7 +309,7 @@ public class CachedPlane
|
||||
alternateDestination.addTile( x, y, z, te, null, mr );
|
||||
}
|
||||
}
|
||||
catch ( Throwable e )
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
@@ -319,8 +319,8 @@ public class CachedPlane
|
||||
{
|
||||
|
||||
// update shit..
|
||||
for ( int x = 0; x < this.cx_size; x++ )
|
||||
for ( int z = 0; z < this.cz_size; z++ )
|
||||
for( int x = 0; x < this.cx_size; x++ )
|
||||
for( int z = 0; z < this.cz_size; z++ )
|
||||
{
|
||||
Chunk c = this.myChunks[x][z];
|
||||
c.resetRelightChecks();
|
||||
@@ -329,20 +329,19 @@ public class CachedPlane
|
||||
}
|
||||
|
||||
// send shit...
|
||||
for ( int x = 0; x < this.cx_size; x++ )
|
||||
for ( int z = 0; z < this.cz_size; z++ )
|
||||
for( int x = 0; x < this.cx_size; x++ )
|
||||
for( int z = 0; z < this.cz_size; z++ )
|
||||
{
|
||||
|
||||
Chunk c = this.myChunks[x][z];
|
||||
|
||||
for ( int y = 1; y < 255; y += 32 )
|
||||
for( int y = 1; y < 255; y += 32 )
|
||||
WorldSettings.getInstance().getCompass().updateArea( this.world, c.xPosition << 4, y, c.zPosition << 4 );
|
||||
|
||||
Platform.sendChunk( c, this.verticalBits );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Column
|
||||
{
|
||||
|
||||
@@ -361,20 +360,20 @@ public class CachedPlane
|
||||
this.storage = this.c.getBlockStorageArray();
|
||||
|
||||
// make sure storage exists before hand...
|
||||
for ( int ay = 0; ay < chunkHeight; ay++ )
|
||||
for( int ay = 0; ay < chunkHeight; ay++ )
|
||||
{
|
||||
int by = ( ay + cy );
|
||||
ExtendedBlockStorage extendedblockstorage = this.storage[by];
|
||||
if ( extendedblockstorage == null )
|
||||
if( extendedblockstorage == null )
|
||||
extendedblockstorage = this.storage[by] = new ExtendedBlockStorage( by << 4, !this.c.worldObj.provider.hasNoSky );
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockIDWithMetadata( int y, Object[] blk )
|
||||
{
|
||||
for ( Block matrixFrameBlock : CachedPlane.this.matrixFrame.maybeBlock().asSet() )
|
||||
for( Block matrixFrameBlock : CachedPlane.this.matrixFrame.maybeBlock().asSet() )
|
||||
{
|
||||
if ( blk[0] == matrixFrameBlock )
|
||||
if( blk[0] == matrixFrameBlock )
|
||||
{
|
||||
blk[0] = Platform.AIR;
|
||||
}
|
||||
@@ -399,7 +398,7 @@ public class CachedPlane
|
||||
public boolean doNotSkip( int y )
|
||||
{
|
||||
ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4];
|
||||
if ( CachedPlane.this.reg.isBlacklisted( extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z ) ) )
|
||||
if( CachedPlane.this.reg.isBlacklisted( extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z ) ) )
|
||||
return false;
|
||||
|
||||
return this.skipThese == null || !this.skipThese.contains( y );
|
||||
@@ -407,7 +406,7 @@ public class CachedPlane
|
||||
|
||||
public void setSkip( int yCoord )
|
||||
{
|
||||
if ( this.skipThese == null )
|
||||
if( this.skipThese == null )
|
||||
this.skipThese = new LinkedList<Integer>();
|
||||
this.skipThese.add( yCoord );
|
||||
}
|
||||
|
||||
@@ -18,17 +18,32 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import appeng.api.movable.IMovableHandler;
|
||||
|
||||
|
||||
public class DefaultSpatialHandler implements IMovableHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* never called for the default.
|
||||
*
|
||||
* @param tile tile entity
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
@Override
|
||||
public void moveTile(TileEntity te, World w, int x, int y, int z)
|
||||
public boolean canHandle( Class<? extends TileEntity> myClass, TileEntity tile )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTile( TileEntity te, World w, int x, int y, int z )
|
||||
{
|
||||
|
||||
te.setWorldObj( w );
|
||||
@@ -40,23 +55,10 @@ public class DefaultSpatialHandler implements IMovableHandler
|
||||
c.func_150812_a( x & 0xF, y, z & 0xF, te );
|
||||
// c.setChunkBlockTileEntity( x & 0xF, y, z & 0xF, te );
|
||||
|
||||
if ( c.isChunkLoaded )
|
||||
if( c.isChunkLoaded )
|
||||
{
|
||||
w.addTileEntity( te );
|
||||
w.markBlockForUpdate( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* never called for the default.
|
||||
*
|
||||
* @param tile tile entity
|
||||
* @return true
|
||||
*/
|
||||
@Override
|
||||
public boolean canHandle(Class<? extends TileEntity> myClass, TileEntity tile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
public interface ISpatialVisitor
|
||||
{
|
||||
|
||||
void visit(int x, int y, int z);
|
||||
|
||||
void visit( int x, int y, int z );
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ public class StorageChunkProvider extends ChunkProviderGenerate
|
||||
{
|
||||
BLOCKS = new Block[255 * SQUARE_CHUNK_SIZE];
|
||||
|
||||
for ( Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() )
|
||||
for( Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() )
|
||||
{
|
||||
for ( int x = 0; x < BLOCKS.length; x++ )
|
||||
for( int x = 0; x < BLOCKS.length; x++ )
|
||||
{
|
||||
BLOCKS[x] = matrixFrameBlock;
|
||||
}
|
||||
@@ -67,10 +67,10 @@ public class StorageChunkProvider extends ChunkProviderGenerate
|
||||
byte[] biomes = chunk.getBiomeArray();
|
||||
AEConfig config = AEConfig.instance;
|
||||
|
||||
for ( int k = 0; k < biomes.length; ++k )
|
||||
for( int k = 0; k < biomes.length; ++k )
|
||||
biomes[k] = (byte) config.storageBiomeID;
|
||||
|
||||
if ( !chunk.isTerrainPopulated )
|
||||
if( !chunk.isTerrainPopulated )
|
||||
{
|
||||
chunk.isTerrainPopulated = true;
|
||||
chunk.resetRelightChecks();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,125 +38,29 @@ import appeng.api.util.WorldCoord;
|
||||
import appeng.core.stats.Achievements;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class StorageHelper
|
||||
{
|
||||
|
||||
private static StorageHelper instance;
|
||||
Method onEntityRemoved;
|
||||
|
||||
public static StorageHelper getInstance()
|
||||
{
|
||||
if ( instance == null )
|
||||
if( instance == null )
|
||||
instance = new StorageHelper();
|
||||
return instance;
|
||||
}
|
||||
|
||||
static class TriggerUpdates implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
|
||||
public TriggerUpdates(World dst2) {
|
||||
this.dst = dst2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(int x, int y, int z)
|
||||
{
|
||||
Block blk = this.dst.getBlock( x, y, z );
|
||||
blk.onNeighborBlockChange( this.dst, x, y, z, Platform.AIR );
|
||||
}
|
||||
}
|
||||
|
||||
static class WrapInMatrixFrame implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
final Block blkID;
|
||||
final int Meta;
|
||||
|
||||
public WrapInMatrixFrame(Block blockID, int metaData, World dst2) {
|
||||
this.dst = dst2;
|
||||
this.blkID = blockID;
|
||||
this.Meta = metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(int x, int y, int z)
|
||||
{
|
||||
this.dst.setBlock( x, y, z, this.blkID, this.Meta, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
static class TelDestination
|
||||
{
|
||||
|
||||
TelDestination(World _dim, AxisAlignedBB srcBox, double _x, double _y, double _z, int tileX, int tileY, int tileZ) {
|
||||
this.dim = _dim;
|
||||
this.x = Math.min( srcBox.maxX - 0.5, Math.max( srcBox.minX + 0.5, _x + tileX ) );
|
||||
this.y = Math.min( srcBox.maxY - 0.5, Math.max( srcBox.minY + 0.5, _y + tileY ) );
|
||||
this.z = Math.min( srcBox.maxZ - 0.5, Math.max( srcBox.minZ + 0.5, _z + tileZ ) );
|
||||
this.xOff = tileX;
|
||||
this.yOff = tileY;
|
||||
this.zOff = tileZ;
|
||||
}
|
||||
|
||||
final World dim;
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
|
||||
final int xOff;
|
||||
final int yOff;
|
||||
final int zOff;
|
||||
}
|
||||
|
||||
static class METeleporter extends Teleporter
|
||||
{
|
||||
|
||||
final TelDestination destination;
|
||||
|
||||
public METeleporter(WorldServer par1WorldServer, TelDestination d) {
|
||||
super( par1WorldServer );
|
||||
this.destination = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
|
||||
{
|
||||
par1Entity.setLocationAndAngles( this.destination.x, this.destination.y, this.destination.z, par1Entity.rotationYaw, 0.0F );
|
||||
par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean makePortal(Entity par1Entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStalePortalLocations(long par1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Method onEntityRemoved;
|
||||
|
||||
/**
|
||||
* 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, TelDestination link)
|
||||
public Entity teleportEntity( Entity entity, TelDestination link )
|
||||
{
|
||||
WorldServer oldWorld;
|
||||
WorldServer newWorld;
|
||||
@@ -165,26 +70,26 @@ public class StorageHelper
|
||||
{
|
||||
oldWorld = (WorldServer) entity.worldObj;
|
||||
newWorld = (WorldServer) link.dim;
|
||||
player = (entity instanceof EntityPlayerMP) ? (EntityPlayerMP) entity : null;
|
||||
player = ( entity instanceof EntityPlayerMP ) ? (EntityPlayerMP) entity : null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
if ( oldWorld == null )
|
||||
if( oldWorld == null )
|
||||
return entity;
|
||||
if ( newWorld == null )
|
||||
if( newWorld == null )
|
||||
return entity;
|
||||
|
||||
// Is something riding? Handle it first.
|
||||
if ( entity.riddenByEntity != null )
|
||||
if( entity.riddenByEntity != null )
|
||||
{
|
||||
return this.teleportEntity( entity.riddenByEntity, link );
|
||||
}
|
||||
// Are we riding something? Dismount and tell the mount to go first.
|
||||
Entity cart = entity.ridingEntity;
|
||||
if ( cart != null )
|
||||
if( cart != null )
|
||||
{
|
||||
entity.mountEntity( null );
|
||||
cart = this.teleportEntity( cart, link );
|
||||
@@ -195,11 +100,11 @@ public class StorageHelper
|
||||
WorldServer.class.cast( newWorld ).getChunkProvider().loadChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );
|
||||
|
||||
boolean diffDestination = newWorld != oldWorld;
|
||||
if ( diffDestination )
|
||||
if( diffDestination )
|
||||
{
|
||||
if ( player != null )
|
||||
if( player != null )
|
||||
{
|
||||
if ( link.dim.provider instanceof StorageWorldProvider )
|
||||
if( link.dim.provider instanceof StorageWorldProvider )
|
||||
Achievements.SpatialIOExplorer.addToPlayer( player );
|
||||
|
||||
player.mcServer.getConfigurationManager().transferPlayerToDimension( player, link.dim.provider.dimensionId, new METeleporter( newWorld, link ) );
|
||||
@@ -209,20 +114,20 @@ public class StorageHelper
|
||||
int entX = entity.chunkCoordX;
|
||||
int entZ = entity.chunkCoordZ;
|
||||
|
||||
if ( (entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists( entX, entZ )) )
|
||||
if( ( entity.addedToChunk ) && ( oldWorld.getChunkProvider().chunkExists( entX, entZ ) ) )
|
||||
{
|
||||
oldWorld.getChunkFromChunkCoords( entX, entZ ).removeEntity( entity );
|
||||
oldWorld.getChunkFromChunkCoords( entX, entZ ).isModified = true;
|
||||
}
|
||||
|
||||
Entity newEntity = EntityList.createEntityByName( EntityList.getEntityString( entity ), newWorld );
|
||||
if ( newEntity != null )
|
||||
if( newEntity != null )
|
||||
{
|
||||
entity.lastTickPosX = entity.prevPosX = entity.posX = link.x;
|
||||
entity.lastTickPosY = entity.prevPosY = entity.posY = link.y;
|
||||
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = link.z;
|
||||
|
||||
if ( entity instanceof EntityHanging )
|
||||
if( entity instanceof EntityHanging )
|
||||
{
|
||||
EntityHanging h = (EntityHanging) entity;
|
||||
h.field_146063_b += link.xOff;
|
||||
@@ -249,9 +154,9 @@ public class StorageHelper
|
||||
|
||||
entity.worldObj.updateEntityWithOptionalForce( entity, false );
|
||||
|
||||
if ( cart != null )
|
||||
if( cart != null )
|
||||
{
|
||||
if ( player != null )
|
||||
if( player != null )
|
||||
entity.worldObj.updateEntityWithOptionalForce( entity, true );
|
||||
|
||||
entity.mountEntity( cart );
|
||||
@@ -260,36 +165,33 @@ public class StorageHelper
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void transverseEdges(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, ISpatialVisitor visitor)
|
||||
public void transverseEdges( int minX, int minY, int minZ, int maxX, int maxY, int maxZ, ISpatialVisitor visitor )
|
||||
{
|
||||
for (int y = minY; y < maxY; y++)
|
||||
for (int z = minZ; z < maxZ; z++)
|
||||
for( int y = minY; y < maxY; y++ )
|
||||
for( int z = minZ; z < maxZ; z++ )
|
||||
{
|
||||
visitor.visit( minX, y, z );
|
||||
visitor.visit( maxX, y, z );
|
||||
}
|
||||
|
||||
for (int x = minX; x < maxX; x++)
|
||||
for (int z = minZ; z < maxZ; z++)
|
||||
for( int x = minX; x < maxX; x++ )
|
||||
for( int z = minZ; z < maxZ; z++ )
|
||||
{
|
||||
visitor.visit( x, minY, z );
|
||||
visitor.visit( x, maxY, z );
|
||||
}
|
||||
|
||||
for (int x = minX; x < maxX; x++)
|
||||
for (int y = minY; y < maxY; y++)
|
||||
for( int x = minX; x < maxX; x++ )
|
||||
for( int y = minY; y < maxY; y++ )
|
||||
{
|
||||
visitor.visit( x, y, minZ );
|
||||
visitor.visit( x, y, maxZ );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void swapRegions(World src /** over world **/
|
||||
, World dst /** storage cell **/
|
||||
, int x, int y, int z, int i, int j, int k, int scaleX, int scaleY, int scaleZ)
|
||||
public void swapRegions( World src /** over world **/, World dst /** storage cell **/, int x, int y, int z, int i, int j, int k, int scaleX, int scaleY, int scaleZ )
|
||||
{
|
||||
for ( Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() )
|
||||
for( Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() )
|
||||
{
|
||||
this.transverseEdges( i - 1, j - 1, k - 1, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1, new WrapInMatrixFrame( matrixFrameBlock, 0, dst ) );
|
||||
}
|
||||
@@ -307,20 +209,20 @@ public class StorageHelper
|
||||
List<Entity> srcE = src.getEntitiesWithinAABB( Entity.class, srcBox );
|
||||
List<Entity> dstE = dst.getEntitiesWithinAABB( Entity.class, dstBox );
|
||||
|
||||
for (Entity e : dstE)
|
||||
for( Entity e : dstE )
|
||||
{
|
||||
this.teleportEntity( e, new TelDestination( src, srcBox, e.posX, e.posY, e.posZ, -i + x, -j + y, -k + z ) );
|
||||
}
|
||||
|
||||
for (Entity e : srcE)
|
||||
for( Entity e : srcE )
|
||||
{
|
||||
this.teleportEntity( e, new TelDestination( dst, dstBox, e.posX, e.posY, e.posZ, -x + i, -y + j, -z + k ) );
|
||||
}
|
||||
|
||||
for (WorldCoord wc : cDst.updates)
|
||||
for( WorldCoord wc : cDst.updates )
|
||||
cDst.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR );
|
||||
|
||||
for (WorldCoord wc : cSrc.updates)
|
||||
for( WorldCoord wc : cSrc.updates )
|
||||
cSrc.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR );
|
||||
|
||||
this.transverseEdges( x - 1, y - 1, z - 1, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1, new TriggerUpdates( src ) );
|
||||
@@ -338,4 +240,105 @@ public class StorageHelper
|
||||
|
||||
}
|
||||
|
||||
static class TriggerUpdates implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
|
||||
public TriggerUpdates( World dst2 )
|
||||
{
|
||||
this.dst = dst2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit( int x, int y, int z )
|
||||
{
|
||||
Block blk = this.dst.getBlock( x, y, z );
|
||||
blk.onNeighborBlockChange( this.dst, x, y, z, Platform.AIR );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class WrapInMatrixFrame implements ISpatialVisitor
|
||||
{
|
||||
|
||||
final World dst;
|
||||
final Block blkID;
|
||||
final int Meta;
|
||||
|
||||
public WrapInMatrixFrame( Block blockID, int metaData, World dst2 )
|
||||
{
|
||||
this.dst = dst2;
|
||||
this.blkID = blockID;
|
||||
this.Meta = metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit( int x, int y, int z )
|
||||
{
|
||||
this.dst.setBlock( x, y, z, this.blkID, this.Meta, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class TelDestination
|
||||
{
|
||||
|
||||
final World dim;
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
final int xOff;
|
||||
final int yOff;
|
||||
final int zOff;
|
||||
|
||||
TelDestination( World _dim, AxisAlignedBB srcBox, double _x, double _y, double _z, int tileX, int tileY, int tileZ )
|
||||
{
|
||||
this.dim = _dim;
|
||||
this.x = Math.min( srcBox.maxX - 0.5, Math.max( srcBox.minX + 0.5, _x + tileX ) );
|
||||
this.y = Math.min( srcBox.maxY - 0.5, Math.max( srcBox.minY + 0.5, _y + tileY ) );
|
||||
this.z = Math.min( srcBox.maxZ - 0.5, Math.max( srcBox.minZ + 0.5, _z + tileZ ) );
|
||||
this.xOff = tileX;
|
||||
this.yOff = tileY;
|
||||
this.zOff = tileZ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class METeleporter extends Teleporter
|
||||
{
|
||||
|
||||
final TelDestination destination;
|
||||
|
||||
public METeleporter( WorldServer par1WorldServer, TelDestination d )
|
||||
{
|
||||
super( par1WorldServer );
|
||||
this.destination = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeInPortal( Entity par1Entity, double par2, double par4, double par6, float par8 )
|
||||
{
|
||||
par1Entity.setLocationAndAngles( this.destination.x, this.destination.y, this.destination.z, par1Entity.rotationYaw, 0.0F );
|
||||
par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeInExistingPortal( Entity par1Entity, double par2, double par4, double par6, float par8 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean makePortal( Entity par1Entity )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStalePortalLocations( long par1 )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
@@ -33,25 +34,15 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import appeng.client.render.SpatialSkyRender;
|
||||
import appeng.core.Registration;
|
||||
|
||||
|
||||
public class StorageWorldProvider extends WorldProvider
|
||||
{
|
||||
|
||||
public StorageWorldProvider() {
|
||||
public StorageWorldProvider()
|
||||
{
|
||||
this.hasNoSky = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getSpawnPoint()
|
||||
{
|
||||
return new ChunkCoordinates( 0, 0, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespawnHere()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerWorldChunkManager()
|
||||
{
|
||||
@@ -59,14 +50,13 @@ public class StorageWorldProvider extends WorldProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float[] calcSunriseSunsetColors(float p_76560_1_, float p_76560_2_)
|
||||
public IChunkProvider createChunkGenerator()
|
||||
{
|
||||
return null;
|
||||
return new StorageChunkProvider( this.worldObj, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStarBrightness(float par1)
|
||||
public float calculateCelestialAngle( long par1, float par3 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -78,64 +68,35 @@ public class StorageWorldProvider extends WorldProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSnowAt(int x, int y, int z, boolean checkLight)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public float[] calcSunriseSunsetColors( float p_76560_1_, float p_76560_2_ )
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDoLightning(Chunk chunk)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockHighHumidity(int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDaytime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
||||
public Vec3 getFogColor( float par1, float par2 )
|
||||
{
|
||||
return Vec3.createVectorHelper( 0.07, 0.07, 0.07 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesXZShowFog(int par1, int par2)
|
||||
public boolean canRespawnHere()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateCelestialAngle(long par1, float par3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public boolean isSkyColored()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2)
|
||||
public boolean doesXZShowFog( int par1, int par2 )
|
||||
{
|
||||
return Vec3.createVectorHelper( 0.07, 0.07, 0.07 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkProvider createChunkGenerator()
|
||||
{
|
||||
return new StorageChunkProvider( this.worldObj, 0 );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,4 +111,45 @@ public class StorageWorldProvider extends WorldProvider
|
||||
return SpatialSkyRender.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDaytime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSkyColor( Entity cameraEntity, float partialTicks )
|
||||
{
|
||||
return Vec3.createVectorHelper( 0.07, 0.07, 0.07 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStarBrightness( float par1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSnowAt( int x, int y, int z, boolean checkLight )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getSpawnPoint()
|
||||
{
|
||||
return new ChunkCoordinates( 0, 0, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockHighHumidity( int x, int y, int z )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDoLightning( Chunk chunk )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user