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
@@ -25,6 +25,7 @@ import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
@@ -33,9 +34,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
@@ -99,7 +100,13 @@ public final class MeteoritePlacer
this.invalidSpawn.add( Blocks.planks );
this.invalidSpawn.add( Blocks.iron_door );
this.invalidSpawn.add( Blocks.iron_bars );
this.invalidSpawn.add( Blocks.wooden_door );
this.invalidSpawn.add( Blocks.oak_door );
this.invalidSpawn.add( Blocks.acacia_door );
this.invalidSpawn.add( Blocks.birch_door );
this.invalidSpawn.add( Blocks.dark_oak_door );
this.invalidSpawn.add( Blocks.iron_door );
this.invalidSpawn.add( Blocks.jungle_door );
this.invalidSpawn.add( Blocks.spruce_door );
this.invalidSpawn.add( Blocks.brick_block );
this.invalidSpawn.add( Blocks.clay );
this.invalidSpawn.add( Blocks.water );
@@ -183,7 +190,7 @@ public final class MeteoritePlacer
if( j > h + distanceFrom * 0.02 )
{
if( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
if( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), new BlockPos( i, j, k ), EnumFacing.UP ) )
{
if( j > h + distanceFrom * 0.02 )
{
@@ -199,7 +206,7 @@ public final class MeteoritePlacer
}
}
for( Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) )
for( Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.fromBounds( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) )
{
Entity e = (Entity) o;
e.setDead();
@@ -245,7 +252,7 @@ public final class MeteoritePlacer
TileEntity te = w.getTileEntity( x, y, z );
if( te instanceof IInventory )
{
InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP );
InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, EnumFacing.UP );
int primary = Math.max( 1, (int) ( Math.random() * 4 ) );
@@ -379,17 +386,16 @@ public final class MeteoritePlacer
continue;
}
if( blk.isReplaceable( w.getWorld(), i, j, k ) )
if( blk.isReplaceable( w.getWorld(), new BlockPos( i, j, k ) ) )
{
blk = Platform.AIR_BLOCK;
Block blk_b = w.getBlock( i, j + 1, k );
if( blk_b != blk )
{
int meta_b = w.getBlockMetadata( i, j + 1, k );
IBlockState meta_b = w.getBlockState( i, j + 1, k );
w.setBlock( i, j, k, blk_b, meta_b, 3 );
w.setBlock( i, j + 1, k, blk );
w.setBlock( i, j, k, meta_b, 3 );
}
else if( randomShit < 100 * this.crater )
{
@@ -399,7 +405,7 @@ public final class MeteoritePlacer
double dist = dx * dx + dy * dy + dz * dz;
Block xf = w.getBlock( i, j - 1, k );
if( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
if( !xf.isReplaceable( w.getWorld(), new BlockPos(i, j - 1, k) ) )
{
double extraRange = Math.random() * 0.6;
double height = this.crater * ( extraRange + 0.2 ) - Math.abs( dist - this.crater * 1.7 );
@@ -573,7 +579,7 @@ public final class MeteoritePlacer
this.settings.setInteger( "skyMode", skyMode );
w.done();
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.dimensionId, x >> 4, z >> 4, this.settings );
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.getDimensionId(), x >> 4, z >> 4, this.settings );
return true;
}
return false;
@@ -26,9 +26,7 @@ import java.util.concurrent.Callable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;
import appeng.api.features.IWorldGen.WorldGenType;
import appeng.core.AEConfig;
import appeng.core.WorldSettings;
@@ -87,7 +85,7 @@ public final class MeteoriteWorldGen implements IWorldGenerator
continue;
}
if( WorldSettings.getInstance().hasGenerated( w.provider.dimensionId, cx, cz ) )
if( WorldSettings.getInstance().hasGenerated( w.provider.getDimensionId(), cx, cz ) )
{
MeteoritePlacer mp2 = new MeteoritePlacer();
mp2.spawnMeteorite( new ChunkOnly( w, cx, cz ), mp.getSettings() );
@@ -111,7 +109,7 @@ public final class MeteoriteWorldGen implements IWorldGenerator
private Collection<NBTTagCompound> getNearByMeteorites( World w, int chunkX, int chunkZ )
{
return WorldSettings.getInstance().getNearByMeteorites( w.provider.dimensionId, chunkX, chunkZ );
return WorldSettings.getInstance().getNearByMeteorites( w.provider.getDimensionId(), chunkX, chunkZ );
}
class MeteoriteSpawn implements Callable
@@ -154,7 +152,7 @@ public final class MeteoriteWorldGen implements IWorldGenerator
MeteoriteWorldGen.this.tryMeteorite( this.w, this.depth, this.x, this.z );
}
WorldSettings.getInstance().setGenerated( this.w.provider.dimensionId, chunkX, chunkZ );
WorldSettings.getInstance().setGenerated( this.w.provider.getDimensionId(), chunkX, chunkZ );
WorldSettings.getInstance().getCompass().updateArea( this.w, chunkX, chunkZ );
return null;
@@ -22,13 +22,11 @@ package appeng.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
@@ -51,8 +49,8 @@ public final class QuartzWorldGen implements IWorldGenerator
final Block ore = oreDefinition.maybeBlock().orNull();
final Block charged = chargedDefinition.maybeBlock().orNull();
this.oreNormal = new WorldGenMinable( ore, 0, AEConfig.instance.quartzOresPerCluster, Blocks.stone );
this.oreCharged = new WorldGenMinable( charged, 0, AEConfig.instance.quartzOresPerCluster, Blocks.stone );
this.oreNormal = new WorldGenMinable( ore.getDefaultState(), AEConfig.instance.quartzOresPerCluster );
this.oreCharged = new WorldGenMinable( charged.getDefaultState(), AEConfig.instance.quartzOresPerCluster );
}
@Override
@@ -64,7 +62,7 @@ public final class QuartzWorldGen implements IWorldGenerator
{
int x = ( chunkX << 4 ) + 8;
int z = ( chunkZ << 4 ) + 8;
seaLevel = w.getHeightValue( x, z );
seaLevel = w.getHorizon( new BlockPos( x, 0, z) ).getY();
}
if( this.oreNormal == null || this.oreCharged == null )
@@ -85,7 +83,7 @@ public final class QuartzWorldGen implements IWorldGenerator
int cx = chunkX * 16 + r.nextInt( 22 );
int cy = r.nextInt( 40 * seaLevel / 64 ) + r.nextInt( 22 * seaLevel / 64 ) + 12 * seaLevel / 64;
int cz = chunkZ * 16 + r.nextInt( 22 );
whichOre.generate( w, r, cx, cy, cz );
whichOre.generate( w, r, new BlockPos( cx, cy, cz ) );
}
}
}
@@ -2,9 +2,10 @@ package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import appeng.util.Platform;
@@ -48,22 +49,12 @@ public class ChunkOnly extends StandardWorld
return Math.min( in, ( this.cz + 1 ) << 4 );
}
@Override
public int getBlockMetadata( int x, int y, int z )
{
if( this.range( x, y, z ) )
{
return this.target.getBlockMetadata( x & 0xF, y, z & 0xF );
}
return 0;
}
@Override
public Block getBlock( int x, int y, int z )
{
if( this.range( x, y, z ) )
{
return this.target.getBlock( x & 0xF, y, z & 0xF );
return this.target.getBlock( x, y, z );
}
return Platform.AIR_BLOCK;
}
@@ -74,17 +65,17 @@ public class ChunkOnly extends StandardWorld
if( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.w.setBlock( x, y, z, blk, 0, 1 );
this.w.setBlockState( new BlockPos( x, y, z), blk.getDefaultState() );
}
}
@Override
public void setBlock( int x, int y, int z, Block block, int meta, int flags )
public void setBlock( int x, int y, int z, IBlockState state, int flags )
{
if( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.w.setBlock( x, y, z, block, meta, flags & ( ~2 ) );
this.w.setBlockState( new BlockPos( x, y, z ), state, flags & ( ~2 ) );
}
}
@@ -3,7 +3,6 @@ package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
import appeng.util.Platform;
@@ -1,8 +1,7 @@
package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import appeng.api.definitions.IBlockDefinition;
import appeng.util.Platform;
@@ -13,16 +12,14 @@ public class FalloutCopy extends Fallout
public static final double AIR_BLOCK_THRESHOLD = 0.8;
public static final double BLOCK_THRESHOLD_STEP = 0.1;
private final Block block;
private final int meta;
private final IBlockState block;
private final MeteoriteBlockPutter putter;
public FalloutCopy( IMeteoriteWorld w, int x, int y, int z, MeteoriteBlockPutter putter, IBlockDefinition skyStoneDefinition )
{
super( putter, skyStoneDefinition );
this.putter = putter;
this.block = w.getBlock( x, y, z );
this.meta = w.getBlockMetadata( x, y, z );
this.block = w.getBlockState( x, y, z );
}
@Override
@@ -31,7 +28,7 @@ public class FalloutCopy extends Fallout
double a = Math.random();
if( a > SPECIFIED_BLOCK_THRESHOLD )
{
this.putter.put( w, x, y, z, this.block, this.meta );
this.putter.put( w, x, y, z, this.block, 3 );
}
else
{
@@ -50,7 +47,7 @@ public class FalloutCopy extends Fallout
double a = Math.random();
if( a > SPECIFIED_BLOCK_THRESHOLD )
{
this.putter.put( w, x, y, z, this.block, this.meta );
this.putter.put( w, x, y, z, this.block, 3 );
}
else if( a > AIR_BLOCK_THRESHOLD )
{
@@ -2,7 +2,6 @@ package appeng.worldgen.meteorite;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
@@ -2,7 +2,6 @@ package appeng.worldgen.meteorite;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
@@ -2,6 +2,7 @@ package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -18,8 +19,6 @@ public interface IMeteoriteWorld
boolean hasNoSky();
int getBlockMetadata( int x, int y, int z );
Block getBlock( int x, int y, int z );
boolean canBlockSeeTheSky( int i, int j, int k );
@@ -30,7 +29,12 @@ public interface IMeteoriteWorld
void setBlock( int i, int j, int k, Block blk );
void setBlock( int i, int j, int k, Block block, int meta, int l );
void setBlock( int i, int j, int k, IBlockState state, int l );
void done();
IBlockState getBlockState(
int x,
int y,
int z );
}
@@ -2,6 +2,7 @@ package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -20,13 +21,13 @@ public class MeteoriteBlockPutter
return true;
}
public void put( IMeteoriteWorld w, int i, int j, int k, Block blk, int meta )
public void put( IMeteoriteWorld w, int i, int j, int k, IBlockState state, int meta )
{
if( w.getBlock( i, j, k ) == Blocks.bedrock )
{
return;
}
w.setBlock( i, j, k, blk, meta, 3 );
w.setBlock( i, j, k, state, 3 );
}
}
@@ -2,9 +2,11 @@ package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import appeng.util.Platform;
@@ -45,17 +47,7 @@ public class StandardWorld implements IMeteoriteWorld
@Override
public boolean hasNoSky()
{
return !this.w.provider.hasNoSky;
}
@Override
public int getBlockMetadata( int x, int y, int z )
{
if( this.range( x, y, z ) )
{
return this.w.getBlockMetadata( x, y, z );
}
return 0;
return !this.w.provider.getHasNoSky();
}
@Override
@@ -63,7 +55,7 @@ public class StandardWorld implements IMeteoriteWorld
{
if( this.range( x, y, z ) )
{
return this.w.getBlock( x, y, z );
return this.w.getBlockState( new BlockPos( x, y, z ) ).getBlock();
}
return Platform.AIR_BLOCK;
}
@@ -73,7 +65,7 @@ public class StandardWorld implements IMeteoriteWorld
{
if( this.range( x, y, z ) )
{
return this.w.canBlockSeeTheSky( x, y, z );
return this.w.canBlockSeeSky( new BlockPos(x,y,z) );
}
return false;
}
@@ -83,7 +75,7 @@ public class StandardWorld implements IMeteoriteWorld
{
if( this.range( x, y, z ) )
{
return this.w.getTileEntity( x, y, z );
return this.w.getTileEntity( new BlockPos( x, y, z) );
}
return null;
}
@@ -99,16 +91,7 @@ public class StandardWorld implements IMeteoriteWorld
{
if( this.range( x, y, z ) )
{
this.w.setBlock( x, y, z, blk );
}
}
@Override
public void setBlock( int x, int y, int z, Block block, int meta, int flags )
{
if( this.range( x, y, z ) )
{
this.w.setBlock( x, y, z, block, meta, flags );
this.w.setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() );
}
}
@@ -122,4 +105,31 @@ public class StandardWorld implements IMeteoriteWorld
{
return true;
}
@Override
public void setBlock(
int x,
int y,
int z,
IBlockState state,
int l )
{
if( this.range( x, y, z ) )
{
this.w.setBlockState( new BlockPos( x, y, z ), state, l );
}
}
@Override
public IBlockState getBlockState(
int x,
int y,
int z )
{
if( this.range( x, y, z ) )
{
return this.w.getBlockState( new BlockPos(x,y,z) );
}
return Blocks.air.getDefaultState();
}
}