Most of the 1.8 Port.

This commit is contained in:
AlgorithmX2
2015-06-15 19:44:59 -05:00
parent 17465e68e8
commit 38afde724b
824 changed files with 12120 additions and 9158 deletions
+45 -42
View File
@@ -25,18 +25,18 @@ import java.util.List;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkPosition;
import net.minecraft.util.BlockPos;
import net.minecraft.world.NextTickListEntry;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.movable.IMovableHandler;
import appeng.api.movable.IMovableRegistry;
import appeng.api.util.AEPartLocation;
import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.WorldSettings;
@@ -110,18 +110,20 @@ public class CachedPlane
{
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>();
LinkedList<Entry<BlockPos, TileEntity>> rawTiles = new LinkedList<Entry<BlockPos, TileEntity>>();
LinkedList<BlockPos> deadTiles = new LinkedList<BlockPos>();
Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz );
this.myChunks[cx][cz] = c;
rawTiles.addAll( ( (HashMap<ChunkPosition, TileEntity>) c.chunkTileEntityMap ).entrySet() );
for( Entry<ChunkPosition, TileEntity> tx : rawTiles )
rawTiles.addAll( ( (HashMap<BlockPos, TileEntity>) c.getTileEntityMap() ).entrySet() );
for( Entry<BlockPos, TileEntity> tx : rawTiles )
{
ChunkPosition cp = tx.getKey();
BlockPos 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 )
BlockPos tePOS = te.getPos();
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
{
if( mr.askToMove( te ) )
{
@@ -130,26 +132,25 @@ public class CachedPlane
}
else
{
Object[] details = this.myColumns[te.xCoord - minX][te.zCoord - minZ].getDetails( te.yCoord );
Object[] details = this.myColumns[tePOS.getX() - minX][tePOS.getZ() - minZ].getDetails( tePOS.getY() );
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.getWorld(), tePOS ) && blk.isReplaceable( c.getWorld(), tePOS ) )
{
c.worldObj.setBlock( te.xCoord, te.yCoord, te.zCoord, Platform.AIR_BLOCK );
c.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, Platform.AIR_BLOCK );
c.getWorld().setBlockToAir( tePOS );
}
else
{
this.myColumns[te.xCoord - minX][te.zCoord - minZ].setSkip( te.yCoord );
this.myColumns[tePOS.getX() - minX][tePOS.getZ() - minZ].setSkip( tePOS.getY() );
}
}
}
}
for( ChunkPosition cp : deadTiles )
for( BlockPos cp : deadTiles )
{
c.chunkTileEntityMap.remove( cp );
c.getTileEntityMap().remove( cp );
}
long k = this.world.getTotalWorldTime();
@@ -159,9 +160,10 @@ public class CachedPlane
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 )
BlockPos tePOS = entry.position;
if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ )
{
NextTickListEntry newEntry = new NextTickListEntry( entry.xCoord, entry.yCoord, entry.zCoord, entry.func_151351_a() );
NextTickListEntry newEntry = new NextTickListEntry( tePOS, entry.getBlock() );
newEntry.scheduledTime = entry.scheduledTime - k;
this.ticks.add( newEntry );
}
@@ -234,22 +236,26 @@ public class CachedPlane
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 );
BlockPos tePOS = te.getPos();
dst.addTile( tePOS.getX() - this.x_offset, tePOS.getY() - this.y_offset, tePOS.getZ() - this.z_offset, te, this, mr );
}
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 );
BlockPos tePOS = te.getPos();
this.addTile( tePOS.getX() - dst.x_offset, tePOS.getY() - dst.y_offset, tePOS.getZ() - dst.z_offset, te, dst, mr );
}
for( NextTickListEntry entry : this.ticks )
{
dst.addTick( entry.xCoord - this.x_offset, entry.yCoord - this.y_offset, entry.zCoord - this.z_offset, entry );
BlockPos tePOS = entry.position;
dst.addTick( tePOS.getX() - this.x_offset, tePOS.getY() - this.y_offset, tePOS.getZ() - this.z_offset, entry );
}
for( NextTickListEntry entry : dst.ticks )
{
this.addTick( entry.xCoord - dst.x_offset, entry.yCoord - dst.y_offset, entry.zCoord - dst.z_offset, entry );
BlockPos tePOS = entry.position;
this.addTick( tePOS.getX() - dst.x_offset, tePOS.getY() - dst.y_offset, tePOS.getZ() - dst.z_offset, entry );
}
startTime = System.nanoTime();
@@ -265,15 +271,15 @@ public class CachedPlane
private void markForUpdate( int x, int y, int z )
{
this.updates.add( new WorldCoord( x, y, z ) );
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
{
this.updates.add( new WorldCoord( x + d.offsetX, y + d.offsetY, z + d.offsetZ ) );
this.updates.add( new WorldCoord( x + d.xOffset, y + d.yOffset, z + d.zOffset ) );
}
}
private void addTick( int x, int y, int z, 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.world.scheduleUpdate( new BlockPos( x + this.x_offset, y + this.y_offset, z + this.z_offset ), entry.getBlock(), (int) entry.scheduledTime );
}
private void addTile( int x, int y, int z, TileEntity te, CachedPlane alternateDestination, IMovableRegistry mr )
@@ -288,25 +294,24 @@ 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.world, new BlockPos( x + this.x_offset, y + this.y_offset, z + this.z_offset ) );
}
catch( Throwable e )
{
AELog.error( e );
BlockPos pos = new BlockPos( x,y,z);
// attempt recovery...
te.setWorldObj( this.world );
te.xCoord = x;
te.yCoord = y;
te.zCoord = z;
c.c.func_150812_a( c.x, y + y, c.z, te );
te.setPos( pos );
c.c.addTileEntity( new BlockPos( c.x, y + y, c.z ), te );
// c.c.setChunkTileEntity( c.x, y + y, c.z, te );
if( c.c.isChunkLoaded )
if( c.c.isLoaded() )
{
this.world.addTileEntity( te );
this.world.markBlockForUpdate( x, y, z );
this.world.markBlockForUpdate( pos );
}
}
@@ -334,7 +339,7 @@ public class CachedPlane
Chunk c = this.myChunks[x][z];
c.resetRelightChecks();
c.generateSkylightMap();
c.isModified = true;
c.setModified( true );
}
}
@@ -362,7 +367,7 @@ public class CachedPlane
private final int x;
private final int z;
private final Chunk c;
private final Object[] ch = { 0, 0, 0 };
private final Object[] ch = { 0, 0 };
private final ExtendedBlockStorage[] storage;
private List<Integer> skipThese = null;
@@ -380,7 +385,7 @@ public class CachedPlane
ExtendedBlockStorage extendedblockstorage = this.storage[by];
if( extendedblockstorage == null )
{
extendedblockstorage = this.storage[by] = new ExtendedBlockStorage( by << 4, !this.c.worldObj.provider.hasNoSky );
extendedblockstorage = this.storage[by] = new ExtendedBlockStorage( by << 4, !this.c.getWorld().provider.getHasNoSky() );
}
}
}
@@ -396,18 +401,16 @@ public class CachedPlane
}
ExtendedBlockStorage extendedBlockStorage = this.storage[y >> 4];
extendedBlockStorage.func_150818_a( this.x, y & 15, this.z, (Block) blk[0] );
extendedBlockStorage.set( this.x, y & 15, this.z, (IBlockState) blk[0] );
// extendedBlockStorage.setExtBlockID( x, y & 15, z, blk[0] );
extendedBlockStorage.setExtBlockMetadata( this.x, y & 15, this.z, (Integer) blk[1] );
extendedBlockStorage.setExtBlocklightValue( this.x, y & 15, this.z, (Integer) blk[2] );
extendedBlockStorage.setExtBlocklightValue( this.x, y & 15, this.z, (Integer) blk[1] );
}
public Object[] getDetails( int y )
{
ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4];
this.ch[0] = extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z );
this.ch[1] = extendedblockstorage.getExtBlockMetadata( this.x, y & 15, this.z );
this.ch[2] = extendedblockstorage.getExtBlocklightValue( this.x, y & 15, this.z );
this.ch[0] = extendedblockstorage.get( this.x, y & 15, this.z );
this.ch[1] = extendedblockstorage.getExtBlocklightValue( this.x, y & 15, this.z );
return this.ch;
}
@@ -20,9 +20,9 @@ package appeng.spatial;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import appeng.api.movable.IMovableHandler;
@@ -43,22 +43,18 @@ public class DefaultSpatialHandler implements IMovableHandler
}
@Override
public void moveTile( TileEntity te, World w, int x, int y, int z )
public void moveTile( TileEntity te, World w, BlockPos newPosition )
{
te.setWorldObj( w );
te.xCoord = x;
te.yCoord = y;
te.zCoord = z;
te.setPos( newPosition );
Chunk c = w.getChunkFromBlockCoords( x, z );
c.func_150812_a( x & 0xF, y, z & 0xF, te );
// c.setChunkBlockTileEntity( x & 0xF, y, z & 0xF, te );
Chunk c = w.getChunkFromBlockCoords( newPosition );
c.addTileEntity( newPosition, te );
if( c.isChunkLoaded )
if( c.isLoaded() )
{
w.addTileEntity( te );
w.markBlockForUpdate( x, y, z );
w.markBlockForUpdate( newPosition );
}
}
}
@@ -18,9 +18,11 @@
package appeng.spatial;
import net.minecraft.util.BlockPos;
public interface ISpatialVisitor
{
void visit( int x, int y, int z );
void visit( BlockPos pos );
}
@@ -24,11 +24,11 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderGenerate;
import appeng.api.AEApi;
import appeng.core.AEConfig;
@@ -55,14 +55,14 @@ public class StorageChunkProvider extends ChunkProviderGenerate
public StorageChunkProvider( World world, long i )
{
super( world, i, false );
super( world, i, false, null );
this.world = world;
}
@Override
public Chunk provideChunk( int x, int z )
{
Chunk chunk = new Chunk( this.world, BLOCKS, x, z );
Chunk chunk = new Chunk( this.world, x, z );
byte[] biomes = chunk.getBiomeArray();
AEConfig config = AEConfig.instance;
@@ -72,9 +72,9 @@ public class StorageChunkProvider extends ChunkProviderGenerate
biomes[k] = (byte) config.storageBiomeID;
}
if( !chunk.isTerrainPopulated )
if( !chunk.isTerrainPopulated() )
{
chunk.isTerrainPopulated = true;
chunk.setTerrainPopulated( true );
chunk.resetRelightChecks();
}
@@ -94,7 +94,9 @@ public class StorageChunkProvider extends ChunkProviderGenerate
}
@Override
public List getPossibleCreatures( EnumCreatureType a, int b, int c, int d )
public List func_177458_a(
EnumCreatureType p_177458_1_,
BlockPos p_177458_2_ )
{
return new ArrayList();
}
+33 -32
View File
@@ -23,16 +23,17 @@ import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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;
@@ -103,7 +104,7 @@ public class StorageHelper
}
// load the chunk!
WorldServer.class.cast( newWorld ).getChunkProvider().loadChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );
WorldServer.class.cast( newWorld ).getChunkProvider().provideChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );
boolean diffDestination = newWorld != oldWorld;
if( diffDestination )
@@ -115,7 +116,7 @@ public class StorageHelper
Achievements.SpatialIOExplorer.addToPlayer( player );
}
player.mcServer.getConfigurationManager().transferPlayerToDimension( player, link.dim.provider.dimensionId, new METeleporter( newWorld, link ) );
player.mcServer.getConfigurationManager().transferPlayerToDimension( player, link.dim.provider.getDimensionId(), new METeleporter( newWorld, link ) );
}
else
{
@@ -125,7 +126,7 @@ public class StorageHelper
if( ( entity.addedToChunk ) && ( oldWorld.getChunkProvider().chunkExists( entX, entZ ) ) )
{
oldWorld.getChunkFromChunkCoords( entX, entZ ).removeEntity( entity );
oldWorld.getChunkFromChunkCoords( entX, entZ ).isModified = true;
oldWorld.getChunkFromChunkCoords( entX, entZ ).setModified( true );
}
Entity newEntity = EntityList.createEntityByName( EntityList.getEntityString( entity ), newWorld );
@@ -138,13 +139,11 @@ public class StorageHelper
if( entity instanceof EntityHanging )
{
EntityHanging h = (EntityHanging) entity;
h.field_146063_b += link.xOff;
h.field_146064_c += link.yOff;
h.field_146062_d += link.zOff;
h.setPosition( link.x, link.y, link.z ); // TODO: VERIFIY THIS WORKS
}
newEntity.copyDataFrom( entity, true );
newEntity.dimension = newWorld.provider.dimensionId;
newEntity.copyDataFromOld( entity );
newEntity.dimension = newWorld.provider.getDimensionId();
newEntity.forceSpawn = true;
entity.isDead = true;
@@ -183,8 +182,8 @@ public class StorageHelper
{
for( int z = minZ; z < maxZ; z++ )
{
visitor.visit( minX, y, z );
visitor.visit( maxX, y, z );
visitor.visit( new BlockPos( minX, y, z ) );
visitor.visit( new BlockPos( maxX, y, z ) );
}
}
@@ -192,8 +191,8 @@ public class StorageHelper
{
for( int z = minZ; z < maxZ; z++ )
{
visitor.visit( x, minY, z );
visitor.visit( x, maxY, z );
visitor.visit( new BlockPos( x, minY, z ) );
visitor.visit( new BlockPos( x, maxY, z ) );
}
}
@@ -201,8 +200,8 @@ public class StorageHelper
{
for( int y = minY; y < maxY; y++ )
{
visitor.visit( x, y, minZ );
visitor.visit( x, y, maxZ );
visitor.visit( new BlockPos( x, y, minZ ) );
visitor.visit( new BlockPos( x, y, maxZ ) );
}
}
}
@@ -211,12 +210,12 @@ public class StorageHelper
{
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 ) );
this.transverseEdges( i - 1, j - 1, k - 1, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1, new WrapInMatrixFrame( matrixFrameBlock.getDefaultState(), dst ) );
}
AxisAlignedBB srcBox = AxisAlignedBB.getBoundingBox( x, y, z, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1 );
AxisAlignedBB srcBox = AxisAlignedBB.fromBounds( x, y, z, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1 );
AxisAlignedBB dstBox = AxisAlignedBB.getBoundingBox( i, j, k, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1 );
AxisAlignedBB dstBox = AxisAlignedBB.fromBounds( i, j, k, i + scaleX + 1, j + scaleY + 1, k + scaleZ + 1 );
CachedPlane cDst = new CachedPlane( dst, i, j, k, i + scaleX, j + scaleY, k + scaleZ );
CachedPlane cSrc = new CachedPlane( src, x, y, z, x + scaleX, y + scaleY, z + scaleZ );
@@ -239,12 +238,12 @@ public class StorageHelper
for( WorldCoord wc : cDst.updates )
{
cDst.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
cSrc.world.notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK );
}
for( WorldCoord wc : cSrc.updates )
{
cSrc.world.notifyBlockOfNeighborChange( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
cSrc.world.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 ) );
@@ -273,10 +272,10 @@ public class StorageHelper
}
@Override
public void visit( int x, int y, int z )
public void visit( BlockPos pos )
{
Block blk = this.dst.getBlock( x, y, z );
blk.onNeighborBlockChange( this.dst, x, y, z, Platform.AIR_BLOCK );
Block blk = this.dst.getBlockState( pos ).getBlock();
blk.onNeighborBlockChange( this.dst, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK);
}
}
@@ -285,20 +284,18 @@ public class StorageHelper
{
final World dst;
final Block blkID;
final int Meta;
final IBlockState state;
public WrapInMatrixFrame( Block blockID, int metaData, World dst2 )
public WrapInMatrixFrame( IBlockState state, World dst2 )
{
this.dst = dst2;
this.blkID = blockID;
this.Meta = metaData;
this.state = state;
}
@Override
public void visit( int x, int y, int z )
public void visit( BlockPos pos )
{
this.dst.setBlock( x, y, z, this.blkID, this.Meta, 3 );
this.dst.setBlockState( pos, state );
}
}
@@ -339,14 +336,18 @@ public class StorageHelper
}
@Override
public void placeInPortal( Entity par1Entity, double par2, double par4, double par6, float par8 )
public void placeInPortal(
Entity par1Entity,
float rotationYaw )
{
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 )
public boolean placeInExistingPortal(
Entity entityIn,
float p_180620_2_ )
{
return false;
}
@@ -20,17 +20,15 @@ package appeng.spatial;
import net.minecraft.entity.Entity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.IRenderHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.client.render.SpatialSkyRender;
import appeng.core.Registration;
@@ -77,7 +75,7 @@ public class StorageWorldProvider extends WorldProvider
@Override
public Vec3 getFogColor( float par1, float par2 )
{
return Vec3.createVectorHelper( 0.07, 0.07, 0.07 );
return new Vec3( 0.07, 0.07, 0.07 );
}
@Override
@@ -120,7 +118,7 @@ public class StorageWorldProvider extends WorldProvider
@Override
public Vec3 getSkyColor( Entity cameraEntity, float partialTicks )
{
return Vec3.createVectorHelper( 0.07, 0.07, 0.07 );
return new Vec3( 0.07, 0.07, 0.07 );
}
@Override
@@ -130,19 +128,19 @@ public class StorageWorldProvider extends WorldProvider
}
@Override
public boolean canSnowAt( int x, int y, int z, boolean checkLight )
public boolean canSnowAt( BlockPos pos, boolean checkLight )
{
return false;
}
@Override
public ChunkCoordinates getSpawnPoint()
public BlockPos getSpawnCoordinate()
{
return new ChunkCoordinates( 0, 0, 0 );
return new BlockPos(0,0,0);
}
@Override
public boolean isBlockHighHumidity( int x, int y, int z )
public boolean isBlockHighHumidity( BlockPos pos )
{
return false;
}
@@ -152,4 +150,10 @@ public class StorageWorldProvider extends WorldProvider
{
return false;
}
@Override
public String getInternalNameSuffix()
{
return null;
}
}