parent
caef42dc16
commit
4d1d323c72
49 changed files with 292 additions and 490 deletions
|
@ -767,8 +767,8 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
|
|||
|
||||
// this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
|
||||
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
||||
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.getExtractedExtend(), packetIn.hasBiomes());
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
|
||||
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes());
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
|
||||
|
||||
if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
|
||||
{
|
||||
|
@ -781,7 +781,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
|
|||
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
|
||||
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
||||
chunk.setBiomes(packetIn.getBiomes());
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1413,8 +1413,8 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
|
|||
this.clientWorldController.doPreChunk(j, k, true);
|
||||
// this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
|
||||
Chunk chunk = this.clientWorldController.getChunk(j, k);
|
||||
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), packetIn.getChunkExtend(i), true);
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, -World.MAX_SIZE_Y, k << 4, (j << 4) + 15, World.MAX_SIZE_Y, (k << 4) + 15);
|
||||
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true);
|
||||
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
|
||||
|
||||
if (this.clientWorldController.dimension.hasNoLight()) // TODO: check
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
|
||||
private State getBlockStateRaw(BlockPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
|
@ -136,7 +136,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
else if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
else if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
if (this.getState(pos).getBlock().getSumBrightness())
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
|||
|
||||
public int getLightFor(LightType p_175628_1_, BlockPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
|
|
|
@ -53,7 +53,6 @@ import common.util.Vec3;
|
|||
import common.util.Vector3f;
|
||||
import common.world.Chunk;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class RenderGlobal
|
||||
{
|
||||
|
@ -633,7 +632,7 @@ public class RenderGlobal
|
|||
|
||||
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
|
||||
|
||||
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
|
||||
if (entity2.posY < 0.0D || entity2.posY >= 512.0D || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
|
||||
{
|
||||
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 /* || flag3 */)) {
|
||||
++this.countEntitiesRendered;
|
||||
|
@ -932,7 +931,7 @@ public class RenderGlobal
|
|||
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||
{
|
||||
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= -World.MAX_SIZE_Y && blockpos.getY() < World.MAX_SIZE_Y ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 512 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
}
|
||||
|
||||
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
|
||||
|
|
|
@ -19,12 +19,14 @@ public class EmptyChunk extends Chunk {
|
|||
private final int liquidY;
|
||||
private final State liquid;
|
||||
private final Block liquidBlock;
|
||||
private final int liquidMeta;
|
||||
|
||||
public EmptyChunk(WorldClient world) {
|
||||
super(world, 0, 0);
|
||||
this.liquidY = world.dimension.getSeaLevel() - 1;
|
||||
this.liquid = world.dimension.getLiquid();
|
||||
this.liquidBlock = this.liquid.getBlock();
|
||||
this.liquidMeta = this.liquidBlock.getMetaFromState(this.liquid);
|
||||
}
|
||||
|
||||
public int getHeight(int x, int z) {
|
||||
|
@ -105,7 +107,7 @@ public class EmptyChunk extends Chunk {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void setData(byte[] data, int update, int[] extend, boolean biomes) {
|
||||
public void setData(byte[] data, int update, boolean biomes) {
|
||||
}
|
||||
|
||||
public Biome getBiome(BlockPos pos, BiomeGenerator gen) {
|
||||
|
|
|
@ -36,7 +36,6 @@ import common.util.BlockPos.MutableBlockPos;
|
|||
import common.world.Chunk;
|
||||
import common.world.AWorldClient;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class WorldClient extends AWorldClient
|
||||
{
|
||||
|
@ -81,14 +80,14 @@ public class WorldClient extends AWorldClient
|
|||
this.chunkMapping.add(id, this.emptyChunk);
|
||||
this.emptyChunkListing.remove(id);
|
||||
this.nextEmptyChunkListing.add(id);
|
||||
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
|
||||
this.markBlockRangeForRenderUpdate(x << 4, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
|
||||
}
|
||||
}
|
||||
for(Long id : this.emptyChunkListing) {
|
||||
this.chunkMapping.remove(id);
|
||||
int x = LongHashMap.getX(id);
|
||||
int z = LongHashMap.getZ(id);
|
||||
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
|
||||
this.markBlockRangeForRenderUpdate(x << 4, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
|
||||
}
|
||||
this.emptyChunkListing.clear();
|
||||
this.emptyChunkListing.addAll(this.nextEmptyChunkListing);
|
||||
|
@ -185,7 +184,7 @@ public class WorldClient extends AWorldClient
|
|||
|
||||
if (!load)
|
||||
{
|
||||
this.markBlockRangeForRenderUpdate(x * 16, -World.MAX_SIZE_Y, z * 16, x * 16 + 15, World.MAX_SIZE_Y, z * 16 + 15);
|
||||
this.markBlockRangeForRenderUpdate(x * 16, 0, z * 16, x * 16 + 15, 512, z * 16 + 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class BlockBanner extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityBanner();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BlockBeacon extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityBeacon();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BlockBlueShroom extends BlockBush
|
|||
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos.down());
|
||||
return (iblockstate.getBlock() == Blocks.tian_soil || iblockstate.getBlock() == Blocks.obsidian) ? true : (worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock()));
|
||||
|
|
|
@ -382,7 +382,7 @@ public class BlockBrewingStand extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityBrewingStand();
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ public class BlockChest extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityChest();
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public class BlockDaylightDetector extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityDaylightDetector();
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public class BlockDispenser extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityDispenser();
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ public class BlockDoor extends Block
|
|||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return pos.getY() >= World.MAX_SIZE_Y - 1 ? false : worldIn.isBlockSolid(pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
|
||||
return pos.getY() >= 511 ? false : worldIn.isBlockSolid(pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
|
||||
}
|
||||
|
||||
public int getMobilityFlag()
|
||||
|
|
|
@ -24,7 +24,7 @@ public class BlockDropper extends BlockDispenser
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityDropper();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class BlockEnchantmentTable extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityEnchantmentTable();
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class BlockFurnace extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityFurnace();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BlockHopper extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityHopper();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BlockLilyPad extends BlockBush
|
|||
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos.down());
|
||||
return (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
|
||||
|
|
|
@ -23,7 +23,7 @@ public abstract class BlockMachine extends BlockDirectional implements ITileEnti
|
|||
this.setTab(CheatTab.tabTech);
|
||||
}
|
||||
|
||||
public abstract TileEntity createNewTileEntity(World worldIn);
|
||||
public abstract TileEntity createNewTileEntity(World worldIn, int meta);
|
||||
|
||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
this.updateState(worldIn, pos, state);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BlockMobSpawner extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityMobSpawner();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
|||
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos.down());
|
||||
return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock()));
|
||||
|
|
|
@ -85,7 +85,7 @@ public class BlockNote extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityNote();
|
||||
}
|
||||
|
|
|
@ -548,9 +548,9 @@ public class BlockPistonBase extends Block
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else if (pos.getY() >= -World.MAX_SIZE_Y && (direction != Facing.DOWN || pos.getY() != -World.MAX_SIZE_Y))
|
||||
else if (pos.getY() >= 0 && (direction != Facing.DOWN || pos.getY() != 0))
|
||||
{
|
||||
if (pos.getY() <= World.MAX_SIZE_Y - 1 && (direction != Facing.UP || pos.getY() != World.MAX_SIZE_Y - 1))
|
||||
if (pos.getY() <= World.HEIGHT - 1 && (direction != Facing.UP || pos.getY() != World.HEIGHT - 1))
|
||||
{
|
||||
if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BlockPistonMoving extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
|
|||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn));
|
||||
worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn, 0));
|
||||
}
|
||||
|
||||
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
||||
|
@ -265,7 +265,7 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntityComparator();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class BlockSign extends BlockContainer
|
|||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntitySign();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer
|
|||
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World worldIn)
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileEntitySkull();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
|
||||
public class BlockTianReactor extends BlockMachine {
|
||||
public TileEntity createNewTileEntity(World worldIn) {
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileEntityTianReactor();
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ public class BlockVine extends Block
|
|||
Facing enumfacing1 = Facing.random(rand);
|
||||
BlockPos blockpos1 = pos.up();
|
||||
|
||||
if (enumfacing1 == Facing.UP && pos.getY() < World.MAX_SIZE_Y - 1 && worldIn.isAirBlock(blockpos1))
|
||||
if (enumfacing1 == Facing.UP && pos.getY() < 511 && worldIn.isAirBlock(blockpos1))
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
|
|
|
@ -5,5 +5,8 @@ import common.world.World;
|
|||
|
||||
public interface ITileEntityProvider
|
||||
{
|
||||
TileEntity createNewTileEntity(World worldIn);
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
TileEntity createNewTileEntity(World worldIn, int meta);
|
||||
}
|
||||
|
|
|
@ -975,7 +975,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.seed = tag.getLong("Seed");
|
||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
this.seaLevel = tag.getInteger("SeaLevel");
|
||||
this.filler = BlockRegistry.getFromIdName(tag.getString("FillerBlock"), Blocks.stone.getState());
|
||||
this.liquid = BlockRegistry.getFromIdName(tag.getString("LiquidBlock"), Blocks.water.getState());
|
||||
}
|
||||
}
|
||||
|
@ -1022,6 +1021,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.defaultWeather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
|
||||
this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves"));
|
||||
this.defaultLeaves = this.defaultLeaves == null ? LeavesType.SPRING : this.defaultLeaves;
|
||||
this.filler = BlockRegistry.getFromIdName(tag.getString("FillerBlock"), Blocks.stone.getState());
|
||||
this.top = BlockRegistry.getFromIdName(tag.getString("TopBlock"), Blocks.dirt.getState());
|
||||
this.surface = BlockRegistry.getFromIdName(tag.getString("SurfaceBlock"), Blocks.grass.getState());
|
||||
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.getState());
|
||||
|
@ -1215,7 +1215,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setLong("Seed", this.seed);
|
||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||
tag.setInteger("SeaLevel", this.seaLevel);
|
||||
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
||||
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
||||
}
|
||||
}
|
||||
|
@ -1262,6 +1261,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
tag.setBoolean("SemiFixed", this.semiFixed);
|
||||
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
||||
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
||||
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
||||
tag.setString("TopBlock", BlockRegistry.toIdName(this.top));
|
||||
tag.setString("SurfaceBlock", BlockRegistry.toIdName(this.surface));
|
||||
tag.setString("AltBlock1", BlockRegistry.toIdName(this.alt1));
|
||||
|
|
|
@ -174,7 +174,7 @@ public class EntityFalling extends Entity implements IObjectData
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (this.fallTime > 100 && !this.worldObj.client && (blockpos1.getY() < -World.MAX_SIZE_Y + 1 || blockpos1.getY() > World.MAX_SIZE_Y) || this.fallTime > 600)
|
||||
else if (this.fallTime > 100 && !this.worldObj.client && (blockpos1.getY() < 1 || blockpos1.getY() > 512) || this.fallTime > 600)
|
||||
{
|
||||
if (this.shouldDropItem && Config.objectDrop)
|
||||
{
|
||||
|
|
|
@ -2684,7 +2684,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
else
|
||||
{
|
||||
this.client.addToSendQueue(new CPacketPlayer.C06PacketPlayerPosLook(this.motionX, -99999999.0D, this.motionZ, this.rotYaw, this.rotPitch, this.onGround));
|
||||
this.client.addToSendQueue(new CPacketPlayer.C06PacketPlayerPosLook(this.motionX, -999.0D, this.motionZ, this.rotYaw, this.rotPitch, this.onGround));
|
||||
flag2 = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemBucket extends Item
|
|||
private final BlockDynamicLiquid liquid;
|
||||
|
||||
private static boolean test(AWorldServer world, BlockPos pos, Set<Block> blocks, int max, BlockPos origin, int radius) {
|
||||
if(pos.getY() < -World.MAX_SIZE_Y || pos.getY() > max)
|
||||
if(pos.getY() < 0 || pos.getY() > max)
|
||||
return false;
|
||||
if(pos.getX() < origin.getX() - radius || pos.getX() > origin.getX() + radius)
|
||||
return false;
|
||||
|
@ -54,7 +54,7 @@ public class ItemBucket extends Item
|
|||
List<Vec3i> dirs = new ArrayList<Vec3i>();
|
||||
Set<Block> blocks = liquid == null ? null : Sets.newHashSet(FluidRegistry.getDynamicBlock(liquid), liquid, Blocks.air);
|
||||
State state = (liquid == null ? Blocks.air : liquid).getState();
|
||||
int max = World.MAX_SIZE_Y - 1;
|
||||
int max = 511;
|
||||
|
||||
if(liquid != null) {
|
||||
dirs.add(new Vec3i(1, 0, 0));
|
||||
|
|
|
@ -58,14 +58,16 @@ public class PacketBuffer
|
|||
|
||||
public BlockPos readBlockPos()
|
||||
{
|
||||
return new BlockPos(this.readInt(), this.readInt(), this.readInt());
|
||||
// return new BlockPos(this.readInt(), this.readInt(), this.readInt());
|
||||
return BlockPos.fromLong(this.readLong());
|
||||
}
|
||||
|
||||
public void writeBlockPos(BlockPos pos)
|
||||
{
|
||||
this.writeInt(pos.getX());
|
||||
this.writeInt(pos.getY());
|
||||
this.writeInt(pos.getZ());
|
||||
this.writeLong(pos.toLong());
|
||||
// this.writeInt(pos.getX());
|
||||
// this.writeInt(pos.getY());
|
||||
// this.writeInt(pos.getZ());
|
||||
}
|
||||
|
||||
// public Text readChatComponent() throws IOException
|
||||
|
|
|
@ -21,12 +21,12 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
{
|
||||
}
|
||||
|
||||
public SPacketChunkData(Chunk chunkIn, boolean biomes, int segUpdate, int[] extend)
|
||||
public SPacketChunkData(Chunk chunkIn, boolean biomes, int segUpdate)
|
||||
{
|
||||
this.chunkX = chunkIn.xPos;
|
||||
this.chunkZ = chunkIn.zPos;
|
||||
this.biomes = biomes;
|
||||
this.extractedData = getExtractedData(chunkIn, biomes, !chunkIn.getWorld().dimension.hasNoLight(), segUpdate, extend);
|
||||
this.extractedData = getExtractedData(chunkIn, biomes, !chunkIn.getWorld().dimension.hasNoLight(), segUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,10 +40,6 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
this.extractedData = new SPacketChunkData.Extracted();
|
||||
this.extractedData.dataSize = buf.readInt();
|
||||
this.extractedData.data = buf.readByteArray();
|
||||
this.extractedData.extend = new int[buf.readVarIntFromBuffer()];
|
||||
for(int z = 0; z < this.extractedData.extend.length; z++) {
|
||||
this.extractedData.extend[z] = buf.readVarIntFromBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,10 +52,6 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
buf.writeBoolean(this.biomes);
|
||||
buf.writeInt(this.extractedData.dataSize);
|
||||
buf.writeByteArray(this.extractedData.data);
|
||||
buf.writeVarIntToBuffer(this.extractedData.extend.length);
|
||||
for(int z = 0; z < this.extractedData.extend.length; z++) {
|
||||
buf.writeVarIntToBuffer(this.extractedData.extend[z]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,11 +76,9 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
return i + j + k + l;
|
||||
}
|
||||
|
||||
public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, boolean overworld, int segUpdate, int[] extend)
|
||||
public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, boolean overworld, int segUpdate)
|
||||
{
|
||||
BlockArray[] aextendedblockstorage = chunk.getStorage();
|
||||
BlockArray[] down = chunk.getStorageDown();
|
||||
BlockArray[] up = chunk.getStorageUp();
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = new SPacketChunkData.Extracted();
|
||||
List<BlockArray> list = Lists.<BlockArray>newArrayList();
|
||||
|
||||
|
@ -102,37 +92,8 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
list.add(extendedblockstorage);
|
||||
}
|
||||
}
|
||||
int epos = list.size();
|
||||
if(extend == null) {
|
||||
if(down != null) {
|
||||
for(BlockArray arr : down) {
|
||||
if(arr != null && (!biomes || !arr.isEmpty()))
|
||||
list.add(arr);
|
||||
}
|
||||
}
|
||||
if(up != null) {
|
||||
for(BlockArray arr : up) {
|
||||
if(arr != null && (!biomes || !arr.isEmpty()))
|
||||
list.add(arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int cy : extend) {
|
||||
if(cy < 0 || cy >= aextendedblockstorage.length) {
|
||||
BlockArray arr = chunk.getArray(cy);
|
||||
if(arr != null && (!biomes || !arr.isEmpty()))
|
||||
list.add(arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
extend = new int[list.size() - epos];
|
||||
for(int z = 0; z < extend.length; z++) {
|
||||
extend[z] = list.get(z + epos).getY();
|
||||
}
|
||||
|
||||
s21packetchunkdata$extracted.extend = extend;
|
||||
s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize) + extend.length, overworld, biomes)];
|
||||
|
||||
s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), overworld, biomes)];
|
||||
int j = 0;
|
||||
|
||||
for (BlockArray extendedblockstorage1 : list)
|
||||
|
@ -188,11 +149,6 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
return this.extractedData.dataSize;
|
||||
}
|
||||
|
||||
public int[] getExtractedExtend()
|
||||
{
|
||||
return this.extractedData.extend;
|
||||
}
|
||||
|
||||
public boolean hasBiomes()
|
||||
{
|
||||
return this.biomes;
|
||||
|
@ -202,6 +158,5 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
{
|
||||
public byte[] data;
|
||||
public int dataSize;
|
||||
public int[] extend;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
|||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
Chunk chunk = (Chunk)chunks.get(j);
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = SPacketChunkData.getExtractedData(chunk, true, this.isOverworld, 0xffffffff, null);
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = SPacketChunkData.getExtractedData(chunk, true, this.isOverworld, 0xffffffff);
|
||||
this.xPositions[j] = chunk.xPos;
|
||||
this.zPositions[j] = chunk.zPos;
|
||||
this.chunksData[j] = s21packetchunkdata$extracted;
|
||||
|
@ -54,11 +54,7 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
|||
this.zPositions[j] = buf.readInt();
|
||||
this.chunksData[j] = new SPacketChunkData.Extracted();
|
||||
this.chunksData[j].dataSize = buf.readInt();
|
||||
this.chunksData[j].extend = new int[buf.readVarIntFromBuffer()];
|
||||
for(int z = 0; z < this.chunksData[j].extend.length; z++) {
|
||||
this.chunksData[j].extend[z] = buf.readVarIntFromBuffer();
|
||||
}
|
||||
this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize) + this.chunksData[j].extend.length, this.isOverworld, true)];
|
||||
this.chunksData[j].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize), this.isOverworld, true)];
|
||||
}
|
||||
|
||||
for (int k = 0; k < i; ++k)
|
||||
|
@ -80,10 +76,6 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
|||
buf.writeInt(this.xPositions[i]);
|
||||
buf.writeInt(this.zPositions[i]);
|
||||
buf.writeInt(this.chunksData[i].dataSize);
|
||||
buf.writeVarIntToBuffer(this.chunksData[i].extend.length);
|
||||
for(int z = 0; z < this.chunksData[i].extend.length; z++) {
|
||||
buf.writeVarIntToBuffer(this.chunksData[i].extend[z]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < this.xPositions.length; ++j)
|
||||
|
@ -124,9 +116,4 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
|||
{
|
||||
return this.chunksData[p_179754_1_].dataSize;
|
||||
}
|
||||
|
||||
public int[] getChunkExtend(int index)
|
||||
{
|
||||
return this.chunksData[index].extend;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
{
|
||||
}
|
||||
|
||||
public SPacketMultiBlockChange(int p_i45181_1_, long[] crammedPositionsIn, Chunk chunkIn)
|
||||
public SPacketMultiBlockChange(int p_i45181_1_, int[] crammedPositionsIn, Chunk chunkIn)
|
||||
{
|
||||
this.chunkPosCoord = new ChunkPos(chunkIn.xPos, chunkIn.zPos);
|
||||
this.changedBlocks = new SPacketMultiBlockChange.BlockUpdateData[p_i45181_1_];
|
||||
|
@ -41,7 +41,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
|
||||
for (int i = 0; i < this.changedBlocks.length; ++i)
|
||||
{
|
||||
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), (State)BlockRegistry.STATEMAP.getByValue(buf.readVarIntFromBuffer()));
|
||||
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readInt(), (State)BlockRegistry.STATEMAP.getByValue(buf.readVarIntFromBuffer()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
|
||||
for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks)
|
||||
{
|
||||
buf.writeLong(s22packetmultiblockchange$blockupdatedata.getRawPos());
|
||||
buf.writeInt(s22packetmultiblockchange$blockupdatedata.getRawPos());
|
||||
buf.writeVarIntToBuffer(BlockRegistry.STATEMAP.get(s22packetmultiblockchange$blockupdatedata.getBlockState()));
|
||||
}
|
||||
}
|
||||
|
@ -76,16 +76,16 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
|
||||
public class BlockUpdateData
|
||||
{
|
||||
private final long position;
|
||||
private final int position;
|
||||
private final State blockState;
|
||||
|
||||
public BlockUpdateData(long raw, State state)
|
||||
public BlockUpdateData(int raw, State state)
|
||||
{
|
||||
this.position = raw;
|
||||
this.blockState = state;
|
||||
}
|
||||
|
||||
public BlockUpdateData(long raw, Chunk chunkIn)
|
||||
public BlockUpdateData(int raw, Chunk chunkIn)
|
||||
{
|
||||
this.position = raw;
|
||||
this.blockState = chunkIn.getState(this.getPos());
|
||||
|
@ -93,11 +93,11 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
|||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
ChunkPos pos = SPacketMultiBlockChange.this.chunkPosCoord;
|
||||
return new BlockPos(new BlockPos((pos.x << 4) + (int)(this.position >> 36 & 15L), (int)(this.position & 4294967295L), (pos.z << 4) + (int)(this.position >> 32 & 15L)));
|
||||
ChunkPos r = SPacketMultiBlockChange.this.chunkPosCoord;
|
||||
return new BlockPos(new BlockPos((r.x << 4) + (this.position >> 13 & 15), this.position & 511, (r.z << 4) + (this.position >> 9 & 15)));
|
||||
}
|
||||
|
||||
public long getRawPos()
|
||||
public int getRawPos()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class PathCache extends ChunkCache implements IBlockAccess
|
|||
|
||||
public State getState(BlockPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
if (pos.getY() >= 0 && pos.getY() < 512)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.chunkX;
|
||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable
|
|||
int j = this.pos.getX();
|
||||
int k = this.pos.getY();
|
||||
int l = this.pos.getZ();
|
||||
BoundingBox axisalignedbb = (new BoundingBox((double)j, (double)k, (double)l, (double)(j + 1), (double)(k + 1), (double)(l + 1))).expand(d0, d0, d0).addCoord(0.0D, (double)World.MAX_SIZE_Y, 0.0D);
|
||||
BoundingBox axisalignedbb = (new BoundingBox((double)j, (double)k, (double)l, (double)(j + 1), (double)(k + 1), (double)(l + 1))).expand(d0, d0, d0).addCoord(0.0D, (double)World.HEIGHT, 0.0D);
|
||||
List<EntityLiving> list = this.worldObj.<EntityLiving>getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
|
||||
|
||||
for (EntityLiving entityplayer : list)
|
||||
|
|
|
@ -8,6 +8,14 @@ import common.entity.Entity;
|
|||
public class BlockPos extends Vec3i
|
||||
{
|
||||
public static final BlockPos ORIGIN = new BlockPos(0, 0, 0);
|
||||
private static final int NUM_X_BITS = 1 + 26; // ExtMath.calculateLogBaseTwo(ExtMath.roundUpToPowerOfTwo(World.MAX_SIZE));
|
||||
private static final int NUM_Z_BITS = NUM_X_BITS;
|
||||
private static final int NUM_Y_BITS = 64 - NUM_X_BITS - NUM_Z_BITS;
|
||||
private static final int Y_SHIFT = 0 + NUM_Z_BITS;
|
||||
private static final int X_SHIFT = Y_SHIFT + NUM_Y_BITS;
|
||||
private static final long X_MASK = (1L << NUM_X_BITS) - 1L;
|
||||
private static final long Y_MASK = (1L << NUM_Y_BITS) - 1L;
|
||||
private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L;
|
||||
|
||||
public BlockPos(int x, int y, int z)
|
||||
{
|
||||
|
@ -185,6 +193,19 @@ public class BlockPos extends Vec3i
|
|||
{
|
||||
return new BlockPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX());
|
||||
}
|
||||
|
||||
public long toLong()
|
||||
{
|
||||
return ((long)this.getX() & X_MASK) << X_SHIFT | ((long)this.getY() & Y_MASK) << Y_SHIFT | ((long)this.getZ() & Z_MASK) << 0;
|
||||
}
|
||||
|
||||
public static BlockPos fromLong(long serialized)
|
||||
{
|
||||
int i = (int)(serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
|
||||
int j = (int)(serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
|
||||
int k = (int)(serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
|
||||
return new BlockPos(i, j, k);
|
||||
}
|
||||
|
||||
public static Iterable<BlockPos> getAllInBox(BlockPos from, BlockPos to)
|
||||
{
|
||||
|
|
|
@ -31,8 +31,6 @@ public class Chunk {
|
|||
public final int xPos;
|
||||
public final int zPos;
|
||||
private final World world;
|
||||
private final State filler;
|
||||
private final Block fillerBlock;
|
||||
private final BlockArray[] blocks = new BlockArray[32];
|
||||
private final byte[] biomes = new byte[256];
|
||||
private final int[] precHeight = new int[256];
|
||||
|
@ -50,24 +48,18 @@ public class Chunk {
|
|||
private boolean modified;
|
||||
private boolean hasEntity;
|
||||
private int minHeight;
|
||||
private int lightChecks = Integer.MAX_VALUE;
|
||||
private int bottom = Integer.MAX_VALUE;
|
||||
private int top = Integer.MIN_VALUE;
|
||||
private int lightChecks = 8192;
|
||||
private long lastSave;
|
||||
private long inhabited;
|
||||
private BlockArray[] extendDown;
|
||||
private BlockArray[] extendUp;
|
||||
|
||||
public Chunk(World world, int x, int z) {
|
||||
this.world = world;
|
||||
this.xPos = x;
|
||||
this.zPos = z;
|
||||
this.filler = world.dimension.getFiller();
|
||||
this.fillerBlock = this.filler.getBlock();
|
||||
for(int y = 0; y < this.entities.length; ++y) {
|
||||
this.entities[y] = new ClassInheritanceMultiMap(Entity.class);
|
||||
}
|
||||
Arrays.fill(this.precHeight, -99999999);
|
||||
Arrays.fill(this.precHeight, -999);
|
||||
Arrays.fill(this.biomes, (byte)-1);
|
||||
}
|
||||
|
||||
|
@ -118,8 +110,6 @@ public class Chunk {
|
|||
for(int n = 0; n < this.biomes.length; ++n) {
|
||||
this.biomes[n] = (byte)biomes[n].id;
|
||||
}
|
||||
this.bottom = height == 0 ? Integer.MAX_VALUE : 0;
|
||||
this.top = height == 0 ? Integer.MIN_VALUE : (height + 15) >> 4;
|
||||
if(ceil == null)
|
||||
this.genSkyLight();
|
||||
else
|
||||
|
@ -134,110 +124,29 @@ public class Chunk {
|
|||
return this.height[z << 4 | x];
|
||||
}
|
||||
|
||||
private int findTopSegment() {
|
||||
if(this.extendUp != null) {
|
||||
for(int y = this.extendUp.length - 1; y >= 0; --y) {
|
||||
if(this.extendUp[y] != null)
|
||||
return this.extendUp[y].getY();
|
||||
}
|
||||
}
|
||||
for(int y = this.blocks.length - 1; y >= 0; --y) {
|
||||
if(this.blocks[y] != null)
|
||||
return this.blocks[y].getY();
|
||||
}
|
||||
if(this.extendDown != null) {
|
||||
for(int y = this.extendDown.length - 1; y >= 0; --y) {
|
||||
if(this.extendDown[y] != null)
|
||||
return this.extendDown[y].getY();
|
||||
}
|
||||
}
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
private int findBottomSegment() {
|
||||
if(this.extendDown != null) {
|
||||
for(int y = 0; y < this.extendDown.length; ++y) {
|
||||
if(this.extendDown[y] != null)
|
||||
return this.extendDown[y].getY();
|
||||
}
|
||||
}
|
||||
for(int y = 0; y < this.blocks.length; ++y) {
|
||||
if(this.blocks[y] != null)
|
||||
return this.blocks[y].getY();
|
||||
}
|
||||
if(this.extendUp != null) {
|
||||
for(int y = 0; y < this.extendUp.length; ++y) {
|
||||
if(this.extendUp[y] != null)
|
||||
return this.extendUp[y].getY();
|
||||
}
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public int getTopSegment() {
|
||||
return this.top;
|
||||
}
|
||||
for(int y = this.blocks.length - 1; y >= 0; --y) {
|
||||
if(this.blocks[y] != null) {
|
||||
return this.blocks[y].getY();
|
||||
}
|
||||
}
|
||||
|
||||
public int getBottomSegment() {
|
||||
return this.bottom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockArray[] getStorage() {
|
||||
return this.blocks;
|
||||
}
|
||||
|
||||
public BlockArray[] getStorageDown() {
|
||||
return this.extendDown;
|
||||
}
|
||||
|
||||
public BlockArray[] getStorageUp() {
|
||||
return this.extendUp;
|
||||
}
|
||||
|
||||
public BlockArray getArray(int y) {
|
||||
return y >= 0 && y < this.blocks.length ? this.blocks[y] : (y < 0 ? (this.extendDown == null || -y > this.extendDown.length ? null : this.extendDown[-this.extendDown.length - y]) : (this.extendUp == null || y - this.blocks.length >= this.extendUp.length ? null : this.extendUp[y - this.blocks.length]));
|
||||
}
|
||||
|
||||
private void setArray(int y, BlockArray array) {
|
||||
if(y >= 0 && y < this.blocks.length) {
|
||||
this.blocks[y] = array;
|
||||
}
|
||||
else if(y < 0) {
|
||||
if(this.extendDown == null) {
|
||||
this.extendDown = new BlockArray[-y];
|
||||
}
|
||||
else if(this.extendDown.length < -y) {
|
||||
BlockArray[] extendDown = this.extendDown;
|
||||
this.extendDown = new BlockArray[-y];
|
||||
System.arraycopy(extendDown, 0, this.extendDown, -y - extendDown.length, extendDown.length);
|
||||
}
|
||||
this.extendDown[-this.extendDown.length - y] = array;
|
||||
}
|
||||
else {
|
||||
if(this.extendUp == null) {
|
||||
this.extendUp = new BlockArray[1 + y - this.blocks.length];
|
||||
}
|
||||
else if(this.extendUp.length <= y - this.blocks.length) {
|
||||
BlockArray[] extendUp = this.extendUp;
|
||||
this.extendUp = new BlockArray[1 + y - this.blocks.length];
|
||||
System.arraycopy(extendUp, 0, this.extendUp, 0, extendUp.length);
|
||||
}
|
||||
this.extendUp[y - this.blocks.length] = array;
|
||||
}
|
||||
this.bottom = this.findBottomSegment();
|
||||
this.top = this.findTopSegment();
|
||||
}
|
||||
|
||||
protected void genHeights() {
|
||||
int top = this.getTopSegment();
|
||||
int bottom = this.getBottomSegment();
|
||||
int h = this.getTopSegment();
|
||||
this.minHeight = Integer.MAX_VALUE;
|
||||
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
this.precHeight[x + (z << 4)] = -99999999;
|
||||
this.precHeight[x + (z << 4)] = -999;
|
||||
|
||||
for(int y = top + 16; y > bottom; --y) {
|
||||
for(int y = h + 16; y > 0; --y) {
|
||||
Block block = this.getBlock0(x, y - 1, z);
|
||||
|
||||
if(block.getLightOpacity() != 0) {
|
||||
|
@ -257,15 +166,14 @@ public class Chunk {
|
|||
}
|
||||
|
||||
public void genSkyLight() {
|
||||
int top = this.getTopSegment();
|
||||
int bottom = this.getBottomSegment();
|
||||
int h = this.getTopSegment();
|
||||
this.minHeight = Integer.MAX_VALUE;
|
||||
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
this.precHeight[x + (z << 4)] = -99999999;
|
||||
this.precHeight[x + (z << 4)] = -999;
|
||||
|
||||
for(int y = top + 16; y > bottom; --y) {
|
||||
for(int y = h + 16; y > 0; --y) {
|
||||
if(this.getOpacity(x, y - 1, z) != 0) {
|
||||
this.height[z << 4 | x] = y;
|
||||
|
||||
|
@ -277,9 +185,9 @@ public class Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
if(!this.world.dimension.hasNoLight() && top != Integer.MIN_VALUE) {
|
||||
if(!this.world.dimension.hasNoLight()) {
|
||||
int l = 15;
|
||||
int y = top + 16 - 1;
|
||||
int y = h + 16 - 1;
|
||||
|
||||
while(true) {
|
||||
int b = this.getOpacity(x, y, z);
|
||||
|
@ -291,7 +199,7 @@ public class Chunk {
|
|||
l -= b;
|
||||
|
||||
if(l > 0) {
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
|
||||
if(stor != null) {
|
||||
stor.setSky(x, y & 15, z, l);
|
||||
|
@ -301,7 +209,7 @@ public class Chunk {
|
|||
|
||||
--y;
|
||||
|
||||
if(y <= bottom || l <= 0) {
|
||||
if(y <= 0 || l <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -377,15 +285,14 @@ public class Chunk {
|
|||
}
|
||||
|
||||
private void relightBlock(int x, int y, int z) {
|
||||
int h = this.height[z << 4 | x];
|
||||
int min = this.getBottomSegment();
|
||||
int h = this.height[z << 4 | x] & 511;
|
||||
int cy = h;
|
||||
|
||||
if(y > h) {
|
||||
cy = y;
|
||||
}
|
||||
|
||||
while(cy > min && this.getOpacity(x, cy - 1, z) == 0) {
|
||||
while(cy > 0 && this.getOpacity(x, cy - 1, z) == 0) {
|
||||
--cy;
|
||||
}
|
||||
|
||||
|
@ -398,7 +305,7 @@ public class Chunk {
|
|||
if(!this.world.dimension.hasNoLight()) {
|
||||
if(cy < h) {
|
||||
for(int n = cy; n < h; ++n) {
|
||||
BlockArray stor = this.getArray(n >> 4);
|
||||
BlockArray stor = this.blocks[n >> 4];
|
||||
|
||||
if(stor != null) {
|
||||
stor.setSky(x, n & 15, z, 15);
|
||||
|
@ -408,7 +315,7 @@ public class Chunk {
|
|||
}
|
||||
else {
|
||||
for(int n = h; n < cy; ++n) {
|
||||
BlockArray stor = this.getArray(n >> 4);
|
||||
BlockArray stor = this.blocks[n >> 4];
|
||||
|
||||
if(stor != null) {
|
||||
stor.setSky(x, n & 15, z, 0);
|
||||
|
@ -419,7 +326,7 @@ public class Chunk {
|
|||
|
||||
int l = 15;
|
||||
|
||||
while(cy > min && l > 0) {
|
||||
while(cy > 0 && l > 0) {
|
||||
--cy;
|
||||
int b = this.getOpacity(x, cy, z);
|
||||
|
||||
|
@ -433,7 +340,7 @@ public class Chunk {
|
|||
l = 0;
|
||||
}
|
||||
|
||||
BlockArray stor = this.getArray(cy >> 4);
|
||||
BlockArray stor = this.blocks[cy >> 4];
|
||||
|
||||
if(stor != null) {
|
||||
stor.setSky(x, cy & 15, z, l);
|
||||
|
@ -473,48 +380,69 @@ public class Chunk {
|
|||
private int getOpacity(int x, int y, int z) {
|
||||
return this.getBlock0(x, y, z).getLightOpacity();
|
||||
}
|
||||
|
||||
|
||||
private Block getBlock0(int x, int y, int z) {
|
||||
Block block = Blocks.air;
|
||||
|
||||
if(y >= 0 && y >> 4 < this.blocks.length) {
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
return stor != null ? stor.getBlock(x, y & 15, z) : Blocks.air;
|
||||
}
|
||||
else if(y < 0 && this.extendDown != null && -(y >> 4) <= this.extendDown.length) {
|
||||
BlockArray stor = this.extendDown[-this.extendDown.length - (y >> 4)];
|
||||
return stor != null ? stor.getBlock(x, y & 15, z) : this.fillerBlock;
|
||||
}
|
||||
else if(y >> 4 >= this.blocks.length && this.extendUp != null && (y >> 4) - this.blocks.length < this.extendUp.length) {
|
||||
BlockArray stor = this.extendUp[(y >> 4) - this.blocks.length];
|
||||
return stor != null ? stor.getBlock(x, y & 15, z) : Blocks.air;
|
||||
}
|
||||
return y < 0 ? this.fillerBlock : Blocks.air;
|
||||
}
|
||||
|
||||
public State getState(BlockPos pos) {
|
||||
if(this.world.debug) {
|
||||
State state = pos.getY() == 1 ? DebugStates.getState(pos.getX(), pos.getZ()) : null;
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
|
||||
if(stor != null) {
|
||||
block = stor.getBlock(x, y & 15, z);
|
||||
}
|
||||
}
|
||||
|
||||
if(pos.getY() >= 0 && pos.getY() >> 4 < this.blocks.length) {
|
||||
BlockArray stor = this.blocks[pos.getY() >> 4];
|
||||
return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : Blocks.air.getState();
|
||||
}
|
||||
else if(pos.getY() < 0 && this.extendDown != null && -(pos.getY() >> 4) <= this.extendDown.length) {
|
||||
BlockArray stor = this.extendDown[-this.extendDown.length - (pos.getY() >> 4)];
|
||||
return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : this.filler;
|
||||
}
|
||||
else if(pos.getY() >> 4 >= this.blocks.length && this.extendUp != null && (pos.getY() >> 4) - this.blocks.length < this.extendUp.length) {
|
||||
BlockArray stor = this.extendUp[(pos.getY() >> 4) - this.blocks.length];
|
||||
return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : Blocks.air.getState();
|
||||
}
|
||||
return pos.getY() < 0 ? this.filler : Blocks.air.getState();
|
||||
return block;
|
||||
}
|
||||
|
||||
public Block getBlock(BlockPos pos) {
|
||||
return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
||||
}
|
||||
|
||||
|
||||
public State getState(BlockPos pos) {
|
||||
if(this.world.debug) {
|
||||
State state = null;
|
||||
|
||||
// if(pos.getY() == 60) {
|
||||
// state = Blocks.glass.getDefaultState();
|
||||
// }
|
||||
|
||||
if(pos.getY() == 1) {
|
||||
state = DebugStates.getState(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= 0 && pos.getY() >> 4 < this.blocks.length) {
|
||||
BlockArray stor = this.blocks[pos.getY() >> 4];
|
||||
|
||||
if(stor != null) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return stor.get(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return Blocks.air.getState();
|
||||
}
|
||||
}
|
||||
|
||||
private int getMeta(int x, int y, int z) {
|
||||
if(y >> 4 >= this.blocks.length) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
return stor != null ? stor.getMeta(x, y & 15, z) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMeta(BlockPos pos) {
|
||||
return this.getMeta(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
||||
}
|
||||
|
||||
public State setState(BlockPos pos, State state) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
|
@ -522,7 +450,7 @@ public class Chunk {
|
|||
int o = z << 4 | x;
|
||||
|
||||
if(y >= this.precHeight[o] - 1) {
|
||||
this.precHeight[o] = -99999999;
|
||||
this.precHeight[o] = -999;
|
||||
}
|
||||
|
||||
int h = this.height[o];
|
||||
|
@ -534,7 +462,7 @@ public class Chunk {
|
|||
else {
|
||||
Block block = state.getBlock();
|
||||
Block oldb = old.getBlock();
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
boolean up = false;
|
||||
|
||||
if(stor == null) {
|
||||
|
@ -542,8 +470,7 @@ public class Chunk {
|
|||
return null;
|
||||
}
|
||||
|
||||
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
|
||||
this.setArray(y >> 4, stor);
|
||||
stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
|
||||
up = y >= h;
|
||||
}
|
||||
|
||||
|
@ -599,7 +526,7 @@ public class Chunk {
|
|||
TileEntity tile = this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK);
|
||||
|
||||
if(tile == null) {
|
||||
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world);
|
||||
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world, block.getMetaFromState(state));
|
||||
this.world.setTileEntity(pos, tile);
|
||||
}
|
||||
|
||||
|
@ -618,7 +545,7 @@ public class Chunk {
|
|||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
return stor == null ? (this.canSeeSky(pos) ? type.defValue : 0)
|
||||
: (type == LightType.SKY ? (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z))
|
||||
: (type == LightType.BLOCK ? stor.getLight(x, y & 15, z) : type.defValue));
|
||||
|
@ -628,11 +555,10 @@ public class Chunk {
|
|||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
|
||||
if(stor == null) {
|
||||
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
|
||||
this.setArray(y >> 4, stor);
|
||||
stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
|
||||
this.genSkyLight();
|
||||
}
|
||||
|
||||
|
@ -652,7 +578,7 @@ public class Chunk {
|
|||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
|
||||
if(stor == null) {
|
||||
return !this.world.dimension.hasNoLight() && amount < LightType.SKY.defValue
|
||||
|
@ -721,7 +647,7 @@ public class Chunk {
|
|||
|
||||
private TileEntity createNewTileEntity(BlockPos pos) {
|
||||
Block block = this.getBlock(pos);
|
||||
return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.world);
|
||||
return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.world, this.getMeta(pos));
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.EnumCreateEntityType type) {
|
||||
|
@ -879,13 +805,12 @@ public class Chunk {
|
|||
int o = x | z << 4;
|
||||
BlockPos loc = new BlockPos(pos.getX(), this.precHeight[o], pos.getZ());
|
||||
|
||||
if(loc.getY() == -99999999) {
|
||||
if(loc.getY() == -999) {
|
||||
int y = this.getTopSegment() + 15;
|
||||
int min = this.getBottomSegment();
|
||||
loc = new BlockPos(pos.getX(), y, pos.getZ());
|
||||
int h = -1;
|
||||
|
||||
while(loc.getY() > min && h == -1) {
|
||||
while(loc.getY() > 0 && h == -1) {
|
||||
Block block = this.getBlock(loc);
|
||||
Material mat = block.getMaterial();
|
||||
|
||||
|
@ -936,8 +861,16 @@ public class Chunk {
|
|||
}
|
||||
|
||||
public boolean isEmpty(int bottom, int top) {
|
||||
if(bottom < 0) {
|
||||
bottom = 0;
|
||||
}
|
||||
|
||||
if(top >= 512) {
|
||||
top = 511;
|
||||
}
|
||||
|
||||
for(int y = bottom; y <= top; y += 16) {
|
||||
BlockArray stor = this.getArray(y >> 4);
|
||||
BlockArray stor = this.blocks[y >> 4];
|
||||
|
||||
if(stor != null && !stor.isEmpty()) {
|
||||
return false;
|
||||
|
@ -947,7 +880,7 @@ public class Chunk {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void setStorage(BlockArray[] arrays, BlockArray[] down, BlockArray[] up) {
|
||||
public void setStorage(BlockArray[] arrays) {
|
||||
if(this.blocks.length != arrays.length) {
|
||||
Log.JNI.warn("Konnte Sektionen des Chunks nicht setzen, Länge des Arrays ist " + arrays.length + " statt "
|
||||
+ this.blocks.length);
|
||||
|
@ -956,14 +889,10 @@ public class Chunk {
|
|||
for(int n = 0; n < this.blocks.length; ++n) {
|
||||
this.blocks[n] = arrays[n];
|
||||
}
|
||||
this.extendDown = down;
|
||||
this.extendUp = up;
|
||||
this.bottom = this.findBottomSegment();
|
||||
this.top = this.findTopSegment();
|
||||
}
|
||||
}
|
||||
|
||||
public void setData(byte[] data, int update, int[] extend, boolean biomes) {
|
||||
public void setData(byte[] data, int update, boolean biomes) {
|
||||
int pos = 0;
|
||||
boolean sky = !this.world.dimension.hasNoLight();
|
||||
|
||||
|
@ -984,23 +913,6 @@ public class Chunk {
|
|||
this.blocks[n] = null;
|
||||
}
|
||||
}
|
||||
if(biomes) {
|
||||
this.extendDown = null;
|
||||
this.extendUp = null;
|
||||
}
|
||||
for(int cy : extend) {
|
||||
BlockArray arr = this.getArray(cy);
|
||||
if(arr == null) {
|
||||
arr = new BlockArray(cy << 4, sky);
|
||||
}
|
||||
|
||||
char[] blocks = arr.getData();
|
||||
|
||||
for(int k = 0; k < blocks.length; ++k) {
|
||||
blocks[k] = (char)((data[pos + 1] & 255) << 8 | data[pos] & 255);
|
||||
pos += 2;
|
||||
}
|
||||
}
|
||||
|
||||
for(int n = 0; n < this.blocks.length; ++n) {
|
||||
if((update & 1 << n) != 0 && this.blocks[n] != null) {
|
||||
|
@ -1009,14 +921,6 @@ public class Chunk {
|
|||
pos += light.getData().length;
|
||||
}
|
||||
}
|
||||
for(int cy : extend) {
|
||||
BlockArray arr = this.getArray(cy);
|
||||
if(arr != null) {
|
||||
NibbleArray light = arr.getBlocklight();
|
||||
System.arraycopy(data, pos, light.getData(), 0, light.getData().length);
|
||||
pos += light.getData().length;
|
||||
}
|
||||
}
|
||||
|
||||
if(sky) {
|
||||
for(int n = 0; n < this.blocks.length; ++n) {
|
||||
|
@ -1026,35 +930,18 @@ public class Chunk {
|
|||
pos += slight.getData().length;
|
||||
}
|
||||
}
|
||||
for(int cy : extend) {
|
||||
BlockArray arr = this.getArray(cy);
|
||||
if(arr != null) {
|
||||
NibbleArray slight = arr.getSkylight();
|
||||
System.arraycopy(data, pos, slight.getData(), 0, slight.getData().length);
|
||||
pos += slight.getData().length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(biomes) {
|
||||
System.arraycopy(data, pos, this.biomes, 0, this.biomes.length);
|
||||
// int unk = pos + this.biomes.length;
|
||||
}
|
||||
|
||||
this.bottom = this.findBottomSegment();
|
||||
this.top = this.findTopSegment();
|
||||
|
||||
for(int n = 0; n < this.blocks.length; ++n) {
|
||||
if(this.blocks[n] != null && (update & 1 << n) != 0) {
|
||||
this.blocks[n].update();
|
||||
}
|
||||
}
|
||||
for(int cy : extend) {
|
||||
BlockArray arr = this.getArray(cy);
|
||||
if(arr != null) {
|
||||
arr.update();
|
||||
}
|
||||
}
|
||||
|
||||
this.lightInit = true;
|
||||
this.populated = true;
|
||||
|
@ -1109,14 +996,11 @@ public class Chunk {
|
|||
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
|
||||
|
||||
for(int n = 0; n < 8; ++n) {
|
||||
if(this.top == Integer.MIN_VALUE)
|
||||
return;
|
||||
int h = 1 + this.top - this.bottom;
|
||||
if(this.lightChecks >= 256 * h)
|
||||
if(this.lightChecks >= 8192)
|
||||
return;
|
||||
|
||||
int s = (this.lightChecks % h) + this.bottom;
|
||||
int x = this.lightChecks / h % 16;
|
||||
int s = this.lightChecks % 31;
|
||||
int x = this.lightChecks / 31 % 16;
|
||||
int z = this.lightChecks / 512;
|
||||
++this.lightChecks;
|
||||
|
||||
|
@ -1124,9 +1008,8 @@ public class Chunk {
|
|||
BlockPos block = pos.add(x, (s << 4) + y, z);
|
||||
boolean edge = y == 0 || y == 15 || x == 0 || x == 15 || z == 0 || z == 15;
|
||||
|
||||
BlockArray arr = this.getArray(s);
|
||||
if(arr == null && edge || arr != null
|
||||
&& arr.getBlock(x, y, z).getMaterial() == Material.air) {
|
||||
if(this.blocks[s] == null && edge || this.blocks[s] != null
|
||||
&& this.blocks[s].getBlock(x, y, z).getMaterial() == Material.air) {
|
||||
for(Facing face : Facing.values()) {
|
||||
BlockPos side = block.offset(face);
|
||||
|
||||
|
@ -1209,12 +1092,11 @@ public class Chunk {
|
|||
|
||||
private boolean updateColumn(int x, int z) {
|
||||
int top = this.getTopSegment();
|
||||
int bottom = this.getBottomSegment();
|
||||
boolean opaque = false;
|
||||
boolean below = false;
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos((this.xPos << 4) + x, 0, (this.zPos << 4) + z);
|
||||
|
||||
for(int y = top + 16 - 1; y > this.world.getSeaLevel() || y > bottom && !below; --y) {
|
||||
for(int y = top + 16 - 1; y > this.world.getSeaLevel() || y > 0 && !below; --y) {
|
||||
pos.set(pos.getX(), y, pos.getZ());
|
||||
int o = this.getOpacity(pos);
|
||||
|
||||
|
@ -1230,7 +1112,7 @@ public class Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
for(int y = pos.getY(); y > bottom; --y) {
|
||||
for(int y = pos.getY(); y > 0; --y) {
|
||||
pos.set(pos.getX(), y, pos.getZ());
|
||||
|
||||
if(this.getBlock(pos).getLightValue() > 0) {
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
public static final float[] MOON_PHASES = new float[] {1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
|
||||
public static final int MAX_SIZE = 67108864;
|
||||
public static final int MAX_SIZE_Y = 4096;
|
||||
public static final int HEIGHT = 512;
|
||||
public static final long START_TIME = 4385238000L;
|
||||
public static final float ABSOLUTE_ZERO = -273.15f;
|
||||
// private static final Calendar calendar = Calendar.getInstance();
|
||||
|
@ -109,7 +109,7 @@ public abstract class World implements IWorldAccess {
|
|||
|
||||
public static boolean isValid(BlockPos pos) {
|
||||
return pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE &&
|
||||
pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y;
|
||||
pos.getY() >= 0 && pos.getY() < 512;
|
||||
}
|
||||
|
||||
public static boolean isValidXZ(BlockPos pos) {
|
||||
|
@ -170,7 +170,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
private boolean isAreaLoaded(int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, boolean allowEmpty) {
|
||||
if(yEnd >= -MAX_SIZE_Y && yStart < MAX_SIZE_Y) {
|
||||
if(yEnd >= 0 && yStart < 512) {
|
||||
xStart = xStart >> 4;
|
||||
zStart = zStart >> 4;
|
||||
xEnd = xEnd >> 4;
|
||||
|
@ -344,12 +344,12 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public int getLight(BlockPos pos) {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
if(pos.getY() < 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, pos.getZ());
|
||||
if(pos.getY() >= 512) {
|
||||
pos = new BlockPos(pos.getX(), 511, pos.getZ());
|
||||
}
|
||||
|
||||
return this.getChunk(pos).getLightSub(pos, 0);
|
||||
|
@ -387,12 +387,12 @@ public abstract class World implements IWorldAccess {
|
|||
|
||||
return i1;
|
||||
}
|
||||
else if(pos.getY() < -MAX_SIZE_Y) {
|
||||
else if(pos.getY() < 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, pos.getZ());
|
||||
if(pos.getY() >= 512) {
|
||||
pos = new BlockPos(pos.getX(), 511, pos.getZ());
|
||||
}
|
||||
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
|
@ -442,8 +442,8 @@ public abstract class World implements IWorldAccess {
|
|||
return 0;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||
if(pos.getY() < 0) {
|
||||
pos = new BlockPos(pos.getX(), 0, pos.getZ());
|
||||
}
|
||||
|
||||
if(!isValid(pos)) {
|
||||
|
@ -485,8 +485,8 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public int getLightFor(LightType type, BlockPos pos) {
|
||||
if(pos.getY() < -MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||
if(pos.getY() < 0) {
|
||||
pos = new BlockPos(pos.getX(), 0, pos.getZ());
|
||||
}
|
||||
|
||||
if(!isValid(pos)) {
|
||||
|
@ -1593,7 +1593,7 @@ public abstract class World implements IWorldAccess {
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y && this.getLightFor(LightType.BLOCK, pos) < 10) {
|
||||
if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) {
|
||||
Block block = this.getState(pos).getBlock();
|
||||
|
||||
if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer))
|
||||
|
|
|
@ -41,6 +41,8 @@ public class ClipboardPlacer {
|
|||
}
|
||||
|
||||
public void setBlock(BlockPos location, ClipboardBlock block) {
|
||||
if(location.getY() < 0 || location.getY() > 511)
|
||||
return;
|
||||
Block type = block.getState().getBlock();
|
||||
if (ReorderRegistry.shouldPlaceLast(type)) {
|
||||
// Place torches, etc. last
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class Command implements Executable {
|
|||
}
|
||||
},
|
||||
new DoubleParser("x", defaulted ? DefType.X : null, (double)(-World.MAX_SIZE), (double)World.MAX_SIZE, centered),
|
||||
new DoubleParser("y", defaulted ? DefType.Y : null, (double)(-World.MAX_SIZE_Y), (double)World.MAX_SIZE_Y, false),
|
||||
new DoubleParser("y", defaulted ? DefType.Y : null, 0.0, (double)World.HEIGHT, false),
|
||||
new DoubleParser("z", defaulted ? DefType.Z : null, (double)(-World.MAX_SIZE), (double)World.MAX_SIZE, centered));
|
||||
}
|
||||
|
||||
|
|
|
@ -970,7 +970,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
if (chunk.isPopulated())
|
||||
{
|
||||
list.add(chunk);
|
||||
list1.addAll(((WorldServer)this.entity.worldObj).getTileEntitiesIn(chunkcoordintpair.x * 16, -World.MAX_SIZE_Y, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, World.MAX_SIZE_Y, chunkcoordintpair.z * 16 + 16));
|
||||
list1.addAll(((WorldServer)this.entity.worldObj).getTileEntitiesIn(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 512, chunkcoordintpair.z * 16 + 16));
|
||||
iterator1.remove();
|
||||
}
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
if (list.size() == 1)
|
||||
{
|
||||
this.sendPacket(new SPacketChunkData((Chunk)list.get(0), true, 0xffffffff, null));
|
||||
this.sendPacket(new SPacketChunkData((Chunk)list.get(0), true, 0xffffffff));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2098,7 +2098,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
float f1 = this.entity.rotYaw;
|
||||
float f2 = this.entity.rotPitch;
|
||||
|
||||
if (packetIn.isMoving() && packetIn.getPositionY() == -99999999.0D)
|
||||
if (packetIn.isMoving() && packetIn.getPositionY() == -999.0D)
|
||||
{
|
||||
packetIn.setMoving(false);
|
||||
}
|
||||
|
@ -2281,7 +2281,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if (blockpos.getY() >= World.MAX_SIZE_Y)
|
||||
else if (blockpos.getY() >= World.HEIGHT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2345,7 +2345,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
|||
this.tryUseItem(itemstack);
|
||||
// }
|
||||
}
|
||||
else if (blockpos.getY() < World.MAX_SIZE_Y - 1 || enumfacing != Facing.UP && blockpos.getY() < World.MAX_SIZE_Y)
|
||||
else if (blockpos.getY() < World.HEIGHT - 1 || enumfacing != Facing.UP && blockpos.getY() < World.HEIGHT)
|
||||
{
|
||||
double max = this.entity.getReachDistance() + 3.0D;
|
||||
max *= max;
|
||||
|
|
|
@ -376,22 +376,12 @@ public class Region {
|
|||
chunk.setInhabited(tag.getLong("InhabitedTime"));
|
||||
NBTTagList sects = tag.getTagList("Sections", 10);
|
||||
int stor = 32;
|
||||
int min = 0;
|
||||
int max = stor - 1;
|
||||
for(int n = 0; n < sects.tagCount(); ++n) {
|
||||
NBTTagCompound sect = sects.getCompoundTagAt(n);
|
||||
int y = sect.getInteger("Y");
|
||||
min = y < min ? y : min;
|
||||
max = y > max ? y : max;
|
||||
}
|
||||
BlockArray[] sections = new BlockArray[stor];
|
||||
BlockArray[] down = min < 0 ? new BlockArray[-min] : null;
|
||||
BlockArray[] up = max >= stor ? new BlockArray[1 + max - stor] : null;
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
|
||||
for(int n = 0; n < sects.tagCount(); ++n) {
|
||||
NBTTagCompound sect = sects.getCompoundTagAt(n);
|
||||
int y = sect.getInteger("Y");
|
||||
int y = sect.getByte("Y");
|
||||
BlockArray storage = new BlockArray(y << 4, light);
|
||||
byte[] blocks = sect.getByteArray("Blocks");
|
||||
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
||||
|
@ -414,15 +404,10 @@ public class Region {
|
|||
}
|
||||
|
||||
storage.update();
|
||||
if(y >= 0 && y < stor)
|
||||
sections[y] = storage;
|
||||
else if(y < 0)
|
||||
down[-down.length - y] = storage;
|
||||
else
|
||||
up[y - stor] = storage;
|
||||
sections[y] = storage;
|
||||
}
|
||||
|
||||
chunk.setStorage(sections, down, up);
|
||||
chunk.setStorage(sections);
|
||||
|
||||
if(tag.hasKey("Biomes", 7)) {
|
||||
chunk.setBiomes(tag.getByteArray("Biomes"));
|
||||
|
@ -510,58 +495,52 @@ public class Region {
|
|||
tag.setBoolean("LightPopulated", chunk.isLightPopulated());
|
||||
tag.setLong("InhabitedTime", chunk.getInhabited());
|
||||
BlockArray[] sections = chunk.getStorage();
|
||||
BlockArray[] down = chunk.getStorage();
|
||||
BlockArray[] up = chunk.getStorage();
|
||||
NBTTagList sects = new NBTTagList();
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
|
||||
for(BlockArray[] sec : new BlockArray[][] {sections, down, up}) {
|
||||
if(sec == null)
|
||||
continue;
|
||||
for(BlockArray storage : sec) {
|
||||
if(storage != null) {
|
||||
NBTTagCompound sect = new NBTTagCompound();
|
||||
sect.setInteger("Y", storage.getY() >> 4);
|
||||
byte[] blocks = new byte[storage.getData().length];
|
||||
NibbleArray data = new NibbleArray();
|
||||
NibbleArray adddata = null;
|
||||
|
||||
for(int c = 0; c < storage.getData().length; ++c) {
|
||||
char cd = storage.getData()[c];
|
||||
int cx = c & 15;
|
||||
int cy = c >> 8 & 15;
|
||||
int cz = c >> 4 & 15;
|
||||
|
||||
if(cd >> 12 != 0) {
|
||||
if(adddata == null) {
|
||||
adddata = new NibbleArray();
|
||||
}
|
||||
|
||||
adddata.set(cx, cy, cz, cd >> 12);
|
||||
for(BlockArray storage : sections) {
|
||||
if(storage != null) {
|
||||
NBTTagCompound sect = new NBTTagCompound();
|
||||
sect.setByte("Y", (byte)(storage.getY() >> 4 & 511));
|
||||
byte[] blocks = new byte[storage.getData().length];
|
||||
NibbleArray data = new NibbleArray();
|
||||
NibbleArray adddata = null;
|
||||
|
||||
for(int c = 0; c < storage.getData().length; ++c) {
|
||||
char cd = storage.getData()[c];
|
||||
int cx = c & 15;
|
||||
int cy = c >> 8 & 15;
|
||||
int cz = c >> 4 & 15;
|
||||
|
||||
if(cd >> 12 != 0) {
|
||||
if(adddata == null) {
|
||||
adddata = new NibbleArray();
|
||||
}
|
||||
|
||||
blocks[c] = (byte)(cd >> 4 & 255);
|
||||
data.set(cx, cy, cz, cd & 15);
|
||||
|
||||
adddata.set(cx, cy, cz, cd >> 12);
|
||||
}
|
||||
|
||||
sect.setByteArray("Blocks", blocks);
|
||||
sect.setByteArray("Data", data.getData());
|
||||
|
||||
if(adddata != null) {
|
||||
sect.setByteArray("Add", adddata.getData());
|
||||
}
|
||||
|
||||
sect.setByteArray("BlockLight", storage.getBlocklight().getData());
|
||||
|
||||
if(light) {
|
||||
sect.setByteArray("SkyLight", storage.getSkylight().getData());
|
||||
}
|
||||
else {
|
||||
sect.setByteArray("SkyLight", new byte[storage.getBlocklight().getData().length]);
|
||||
}
|
||||
|
||||
sects.appendTag(sect);
|
||||
|
||||
blocks[c] = (byte)(cd >> 4 & 255);
|
||||
data.set(cx, cy, cz, cd & 15);
|
||||
}
|
||||
|
||||
sect.setByteArray("Blocks", blocks);
|
||||
sect.setByteArray("Data", data.getData());
|
||||
|
||||
if(adddata != null) {
|
||||
sect.setByteArray("Add", adddata.getData());
|
||||
}
|
||||
|
||||
sect.setByteArray("BlockLight", storage.getBlocklight().getData());
|
||||
|
||||
if(light) {
|
||||
sect.setByteArray("SkyLight", storage.getSkylight().getData());
|
||||
}
|
||||
else {
|
||||
sect.setByteArray("SkyLight", new byte[storage.getBlocklight().getData().length]);
|
||||
}
|
||||
|
||||
sects.appendTag(sect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,10 +90,13 @@ public abstract class Spawner {
|
|||
Chunk chunk = world.getChunk(coord.x, coord.z);
|
||||
int x = coord.x * 16 + world.rand.zrange(16);
|
||||
int z = coord.z * 16 + world.rand.zrange(16);
|
||||
int h = chunk.getTopSegment();
|
||||
if(h == Integer.MIN_VALUE)
|
||||
continue;
|
||||
int y = world.rand.range(chunk.getBottomSegment(), h + 16);
|
||||
int h = chunk.getHeight(new BlockPos(x, 0, z)) + 1;
|
||||
if(h > 0) {
|
||||
int m = h % 16;
|
||||
h = m == 0 ? h : h + 16 - m;
|
||||
}
|
||||
h = h == 0 ? 16 : (h > 0 ? h : chunk.getTopSegment() + 16 - 1);
|
||||
int y = world.rand.excl(h <= 8 ? 0 : 8, h);
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
Block block = world.getState(pos).getBlock();
|
||||
if(!block.isNormalCube()) {
|
||||
|
|
|
@ -741,7 +741,7 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
private BlockPos adjustPosToNearbyEntity(BlockPos pos) {
|
||||
BlockPos blockpos = this.getPrecipitationHeight(pos);
|
||||
BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D,
|
||||
BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.HEIGHT, blockpos.getZ()))).expand(3.0D,
|
||||
3.0D, 3.0D);
|
||||
List<EntityLiving> list = this.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new Predicate<EntityLiving>() {
|
||||
public boolean test(EntityLiving p_apply_1_) {
|
||||
|
@ -2369,7 +2369,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(!this.canBurnAt(pos)) {
|
||||
return false;
|
||||
}
|
||||
if(pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) {
|
||||
if(pos.getY() >= 0 && pos.getY() < 512) {
|
||||
Block block = this.getState(pos).getBlock();
|
||||
|
||||
if(block.getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(this, pos)) {
|
||||
|
@ -2385,7 +2385,7 @@ public final class WorldServer extends AWorldServer {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
if(pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y && this.getLightFor(LightType.BLOCK, pos) < 10) {
|
||||
if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) {
|
||||
State iblockstate = this.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
|
@ -2437,9 +2437,8 @@ public final class WorldServer extends AWorldServer {
|
|||
Chunk chunk = this.getChunk(pos);
|
||||
BlockPos blockpos;
|
||||
BlockPos blockpos1;
|
||||
int bottom;
|
||||
|
||||
for(blockpos = new BlockPos(pos.getX(), chunk.getTopSegment() + 16, pos.getZ()), bottom = chunk.getBottomSegment(); blockpos.getY() >= bottom; blockpos = blockpos1) {
|
||||
for(blockpos = new BlockPos(pos.getX(), chunk.getTopSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) {
|
||||
blockpos1 = blockpos.down();
|
||||
Material material = chunk.getBlock(blockpos1).getMaterial();
|
||||
|
||||
|
@ -2803,10 +2802,8 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
private class PlayerInstance {
|
||||
private final List<EntityNPC> watching = Lists.<EntityNPC>newArrayList();
|
||||
private final Set<Integer> extend = Sets.newHashSet();
|
||||
private final long[] changes = new long[64];
|
||||
private final ChunkPos position;
|
||||
|
||||
private int[] changes = new int[64];
|
||||
private int updates;
|
||||
private int sections;
|
||||
private long prevTime;
|
||||
|
@ -2837,7 +2834,7 @@ public final class WorldServer extends AWorldServer {
|
|||
Chunk chunk = WorldServer.this.getChunk(this.position.x, this.position.z);
|
||||
|
||||
if(chunk.isPopulated()) {
|
||||
player.connection.sendPacket(new SPacketChunkData(chunk, true, 0, new int[0]));
|
||||
player.connection.sendPacket(new SPacketChunkData(chunk, true, 0));
|
||||
}
|
||||
|
||||
this.watching.remove(player);
|
||||
|
@ -2880,13 +2877,10 @@ public final class WorldServer extends AWorldServer {
|
|||
WorldServer.this.toUpdate.add(this);
|
||||
}
|
||||
|
||||
if(y >= 0 && y >> 4 < 32)
|
||||
this.sections |= 1 << (y >> 4);
|
||||
else
|
||||
this.extend.add(y >> 4);
|
||||
this.sections |= 1 << (y >> 4);
|
||||
|
||||
if(this.updates < 64) {
|
||||
long pos = ((long)x & 4294967295L) << 36 | ((long)z & 4294967295L) << 32 | (y & 4294967295L);
|
||||
int pos = x << 13 | z << 9 | y;
|
||||
|
||||
for(int i = 0; i < this.updates; ++i) {
|
||||
if(this.changes[i] == pos) {
|
||||
|
@ -2911,9 +2905,9 @@ public final class WorldServer extends AWorldServer {
|
|||
public void onUpdate() {
|
||||
if(this.updates != 0) {
|
||||
if(this.updates == 1) {
|
||||
int x = (int)(this.changes[0] >> 36 & 15L) + this.position.x * 16;
|
||||
int y = (int)(this.changes[0] & 4294967295L);
|
||||
int z = (int)(this.changes[0] >> 32 & 15L) + this.position.z * 16;
|
||||
int x = (this.changes[0] >> 13 & 15) + this.position.x * 16;
|
||||
int y = this.changes[0] & 511;
|
||||
int z = (this.changes[0] >> 9 & 15) + this.position.z * 16;
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos));
|
||||
|
||||
|
@ -2924,36 +2918,11 @@ public final class WorldServer extends AWorldServer {
|
|||
else if(this.updates == 64) {
|
||||
int x = this.position.x * 16;
|
||||
int z = this.position.z * 16;
|
||||
int[] extend = null;
|
||||
if(!this.biomes) {
|
||||
extend = new int[this.extend.size()];
|
||||
int n = 0;
|
||||
for(Integer i : this.extend) {
|
||||
extend[n++] = i;
|
||||
}
|
||||
}
|
||||
this.sendToAllPlayersWatchingChunk(new SPacketChunkData(WorldServer.this.getChunk(this.position.x, this.position.z),
|
||||
this.biomes, this.sections, extend));
|
||||
|
||||
if(this.biomes) {
|
||||
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16);
|
||||
this.biomes, this.sections));
|
||||
|
||||
for(int n = 0; n < list.size(); ++n) {
|
||||
this.sendTileToAllPlayersWatchingChunk(list.get(n));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int cy = 0; cy < 32; ++cy) {
|
||||
if((this.sections & 1 << cy) != 0) {
|
||||
int y = cy << 4;
|
||||
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, y, z, x + 16, y + 16, z + 16);
|
||||
|
||||
for(int n = 0; n < list.size(); ++n) {
|
||||
this.sendTileToAllPlayersWatchingChunk(list.get(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Integer cy : this.extend) {
|
||||
for(int cy = 0; cy < 32; ++cy) {
|
||||
if((this.sections & 1 << cy) != 0) {
|
||||
int y = cy << 4;
|
||||
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, y, z, x + 16, y + 16, z + 16);
|
||||
|
||||
|
@ -2968,9 +2937,9 @@ public final class WorldServer extends AWorldServer {
|
|||
WorldServer.this.getChunk(this.position.x, this.position.z)));
|
||||
|
||||
for(int n = 0; n < this.updates; ++n) {
|
||||
int x = (int)(this.changes[n] >> 36 & 15L) + this.position.x * 16;
|
||||
int y = (int)(this.changes[n] & 4294967295L);
|
||||
int z = (int)(this.changes[n] >> 32 & 15L) + this.position.z * 16;
|
||||
int x = (this.changes[n] >> 13 & 15) + this.position.x * 16;
|
||||
int y = this.changes[n] & 511;
|
||||
int z = (this.changes[n] >> 9 & 15) + this.position.z * 16;
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(WorldServer.this.getState(pos).getBlock().hasTileEntity()) {
|
||||
|
@ -2981,7 +2950,6 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
this.updates = 0;
|
||||
this.sections = 0;
|
||||
this.extend.clear();
|
||||
this.biomes = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue