Most of the 1.8 Port.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user