make world taller

This commit is contained in:
Sen 2025-05-20 19:06:37 +02:00
parent 3a5a29cf9e
commit caef42dc16
49 changed files with 489 additions and 291 deletions

View file

@ -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.hasBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
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);
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, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
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);
}
/**
@ -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), true);
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
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);
if (this.clientWorldController.dimension.hasNoLight()) // TODO: check
{

View file

@ -87,7 +87,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
private State getBlockStateRaw(BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
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() >= 0 && pos.getY() < 512)
else if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
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() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;

View file

@ -53,6 +53,7 @@ import common.util.Vec3;
import common.util.Vector3f;
import common.world.Chunk;
import common.world.State;
import common.world.World;
public class RenderGlobal
{
@ -632,7 +633,7 @@ public class RenderGlobal
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
if (entity2.posY < 0.0D || entity2.posY >= 512.0D || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
{
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 /* || flag3 */)) {
++this.countEntitiesRendered;
@ -931,7 +932,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() >= 0 && blockpos.getY() < 512 ? (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() >= -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);
}
protected Vector3f getViewVector(Entity entityIn, double partialTicks)

View file

@ -19,14 +19,12 @@ 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) {
@ -107,7 +105,7 @@ public class EmptyChunk extends Chunk {
return true;
}
public void setData(byte[] data, int update, boolean biomes) {
public void setData(byte[] data, int update, int[] extend, boolean biomes) {
}
public Biome getBiome(BlockPos pos, BiomeGenerator gen) {

View file

@ -36,6 +36,7 @@ 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
{
@ -80,14 +81,14 @@ public class WorldClient extends AWorldClient
this.chunkMapping.add(id, this.emptyChunk);
this.emptyChunkListing.remove(id);
this.nextEmptyChunkListing.add(id);
this.markBlockRangeForRenderUpdate(x << 4, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (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, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
}
this.emptyChunkListing.clear();
this.emptyChunkListing.addAll(this.nextEmptyChunkListing);
@ -184,7 +185,7 @@ public class WorldClient extends AWorldClient
if (!load)
{
this.markBlockRangeForRenderUpdate(x * 16, 0, z * 16, x * 16 + 15, 512, z * 16 + 15);
this.markBlockRangeForRenderUpdate(x * 16, -World.MAX_SIZE_Y, z * 16, x * 16 + 15, World.MAX_SIZE_Y, z * 16 + 15);
}
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityBanner();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityBeacon();
}

View file

@ -70,7 +70,7 @@ public class BlockBlueShroom extends BlockBush
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
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()));

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityBrewingStand();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityChest();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityDaylightDetector();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityDispenser();
}

View file

@ -291,7 +291,7 @@ public class BlockDoor extends Block
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
return pos.getY() >= 511 ? false : worldIn.isBlockSolid(pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
return pos.getY() >= World.MAX_SIZE_Y - 1 ? false : worldIn.isBlockSolid(pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
}
public int getMobilityFlag()

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityDropper();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityEnchantmentTable();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityFurnace();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityHopper();
}

View file

@ -64,7 +64,7 @@ public class BlockLilyPad extends BlockBush
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
State iblockstate = worldIn.getState(pos.down());
return (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)

View file

@ -23,7 +23,7 @@ public abstract class BlockMachine extends BlockDirectional implements ITileEnti
this.setTab(CheatTab.tabTech);
}
public abstract TileEntity createNewTileEntity(World worldIn, int meta);
public abstract TileEntity createNewTileEntity(World worldIn);
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) {
this.updateState(worldIn, pos, state);

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityMobSpawner();
}

View file

@ -74,7 +74,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
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()));

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityNote();
}

View file

@ -548,9 +548,9 @@ public class BlockPistonBase extends Block
{
return false;
}
else if (pos.getY() >= 0 && (direction != Facing.DOWN || pos.getY() != 0))
else if (pos.getY() >= -World.MAX_SIZE_Y && (direction != Facing.DOWN || pos.getY() != -World.MAX_SIZE_Y))
{
if (pos.getY() <= World.HEIGHT - 1 && (direction != Facing.UP || pos.getY() != World.HEIGHT - 1))
if (pos.getY() <= World.MAX_SIZE_Y - 1 && (direction != Facing.UP || pos.getY() != World.MAX_SIZE_Y - 1))
{
if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
{

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return null;
}

View file

@ -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, 0));
worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn));
}
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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityComparator();
}

View file

@ -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, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntitySign();
}

View file

@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
}
public TileEntity createNewTileEntity(World worldIn, int meta)
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntitySkull();
}

View file

@ -11,7 +11,7 @@ import common.world.State;
import common.world.World;
public class BlockTianReactor extends BlockMachine {
public TileEntity createNewTileEntity(World worldIn, int meta) {
public TileEntity createNewTileEntity(World worldIn) {
return new TileEntityTianReactor();
}

View file

@ -280,7 +280,7 @@ public class BlockVine extends Block
Facing enumfacing1 = Facing.random(rand);
BlockPos blockpos1 = pos.up();
if (enumfacing1 == Facing.UP && pos.getY() < 511 && worldIn.isAirBlock(blockpos1))
if (enumfacing1 == Facing.UP && pos.getY() < World.MAX_SIZE_Y - 1 && worldIn.isAirBlock(blockpos1))
{
if (!flag)
{

View file

@ -5,8 +5,5 @@ import common.world.World;
public interface ITileEntityProvider
{
/**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/
TileEntity createNewTileEntity(World worldIn, int meta);
TileEntity createNewTileEntity(World worldIn);
}

View file

@ -975,6 +975,7 @@ 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());
}
}
@ -1021,7 +1022,6 @@ 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,6 +1215,7 @@ 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));
}
}
@ -1261,7 +1262,6 @@ 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));

View file

@ -174,7 +174,7 @@ public class EntityFalling extends Entity implements IObjectData
}
}
}
else if (this.fallTime > 100 && !this.worldObj.client && (blockpos1.getY() < 1 || blockpos1.getY() > 512) || this.fallTime > 600)
else if (this.fallTime > 100 && !this.worldObj.client && (blockpos1.getY() < -World.MAX_SIZE_Y + 1 || blockpos1.getY() > World.MAX_SIZE_Y) || this.fallTime > 600)
{
if (this.shouldDropItem && Config.objectDrop)
{

View file

@ -2684,7 +2684,7 @@ public abstract class EntityNPC extends EntityLiving
}
else
{
this.client.addToSendQueue(new CPacketPlayer.C06PacketPlayerPosLook(this.motionX, -999.0D, this.motionZ, this.rotYaw, this.rotPitch, this.onGround));
this.client.addToSendQueue(new CPacketPlayer.C06PacketPlayerPosLook(this.motionX, -99999999.0D, this.motionZ, this.rotYaw, this.rotPitch, this.onGround));
flag2 = false;
}

View file

@ -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() < 0 || pos.getY() > max)
if(pos.getY() < -World.MAX_SIZE_Y || 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 = 511;
int max = World.MAX_SIZE_Y - 1;
if(liquid != null) {
dirs.add(new Vec3i(1, 0, 0));

View file

@ -58,16 +58,14 @@ public class PacketBuffer
public BlockPos readBlockPos()
{
// return new BlockPos(this.readInt(), this.readInt(), this.readInt());
return BlockPos.fromLong(this.readLong());
return new BlockPos(this.readInt(), this.readInt(), this.readInt());
}
public void writeBlockPos(BlockPos pos)
{
this.writeLong(pos.toLong());
// this.writeInt(pos.getX());
// this.writeInt(pos.getY());
// this.writeInt(pos.getZ());
this.writeInt(pos.getX());
this.writeInt(pos.getY());
this.writeInt(pos.getZ());
}
// public Text readChatComponent() throws IOException

View file

@ -21,12 +21,12 @@ public class SPacketChunkData implements Packet<IClientPlayer>
{
}
public SPacketChunkData(Chunk chunkIn, boolean biomes, int segUpdate)
public SPacketChunkData(Chunk chunkIn, boolean biomes, int segUpdate, int[] extend)
{
this.chunkX = chunkIn.xPos;
this.chunkZ = chunkIn.zPos;
this.biomes = biomes;
this.extractedData = getExtractedData(chunkIn, biomes, !chunkIn.getWorld().dimension.hasNoLight(), segUpdate);
this.extractedData = getExtractedData(chunkIn, biomes, !chunkIn.getWorld().dimension.hasNoLight(), segUpdate, extend);
}
/**
@ -40,6 +40,10 @@ 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();
}
}
/**
@ -52,6 +56,10 @@ 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]);
}
}
/**
@ -76,9 +84,11 @@ public class SPacketChunkData implements Packet<IClientPlayer>
return i + j + k + l;
}
public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, boolean overworld, int segUpdate)
public static SPacketChunkData.Extracted getExtractedData(Chunk chunk, boolean biomes, boolean overworld, int segUpdate, int[] extend)
{
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();
@ -92,8 +102,37 @@ 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.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), overworld, biomes)];
s21packetchunkdata$extracted.extend = extend;
s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize) + extend.length, overworld, biomes)];
int j = 0;
for (BlockArray extendedblockstorage1 : list)
@ -149,6 +188,11 @@ public class SPacketChunkData implements Packet<IClientPlayer>
return this.extractedData.dataSize;
}
public int[] getExtractedExtend()
{
return this.extractedData.extend;
}
public boolean hasBiomes()
{
return this.biomes;
@ -158,5 +202,6 @@ public class SPacketChunkData implements Packet<IClientPlayer>
{
public byte[] data;
public int dataSize;
public int[] extend;
}
}

View file

@ -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);
SPacketChunkData.Extracted s21packetchunkdata$extracted = SPacketChunkData.getExtractedData(chunk, true, this.isOverworld, 0xffffffff, null);
this.xPositions[j] = chunk.xPos;
this.zPositions[j] = chunk.zPos;
this.chunksData[j] = s21packetchunkdata$extracted;
@ -54,7 +54,11 @@ 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].data = new byte[SPacketChunkData.getSize(Integer.bitCount(this.chunksData[j].dataSize), this.isOverworld, true)];
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)];
}
for (int k = 0; k < i; ++k)
@ -76,6 +80,10 @@ 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)
@ -116,4 +124,9 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
{
return this.chunksData[p_179754_1_].dataSize;
}
public int[] getChunkExtend(int index)
{
return this.chunksData[index].extend;
}
}

View file

@ -20,7 +20,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
{
}
public SPacketMultiBlockChange(int p_i45181_1_, int[] crammedPositionsIn, Chunk chunkIn)
public SPacketMultiBlockChange(int p_i45181_1_, long[] 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.readInt(), (State)BlockRegistry.STATEMAP.getByValue(buf.readVarIntFromBuffer()));
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), (State)BlockRegistry.STATEMAP.getByValue(buf.readVarIntFromBuffer()));
}
}
@ -56,7 +56,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks)
{
buf.writeInt(s22packetmultiblockchange$blockupdatedata.getRawPos());
buf.writeLong(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 int position;
private final long position;
private final State blockState;
public BlockUpdateData(int raw, State state)
public BlockUpdateData(long raw, State state)
{
this.position = raw;
this.blockState = state;
}
public BlockUpdateData(int raw, Chunk chunkIn)
public BlockUpdateData(long 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 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)));
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)));
}
public int getRawPos()
public long getRawPos()
{
return this.position;
}

View file

@ -17,7 +17,7 @@ public class PathCache extends ChunkCache implements IBlockAccess
public State getState(BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;

View file

@ -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.HEIGHT, 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.MAX_SIZE_Y, 0.0D);
List<EntityLiving> list = this.worldObj.<EntityLiving>getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
for (EntityLiving entityplayer : list)

View file

@ -8,14 +8,6 @@ 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)
{
@ -194,19 +186,6 @@ 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)
{
final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));

View file

@ -31,6 +31,8 @@ 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];
@ -48,18 +50,24 @@ public class Chunk {
private boolean modified;
private boolean hasEntity;
private int minHeight;
private int lightChecks = 8192;
private int lightChecks = Integer.MAX_VALUE;
private int bottom = Integer.MAX_VALUE;
private int top = Integer.MIN_VALUE;
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, -999);
Arrays.fill(this.precHeight, -99999999);
Arrays.fill(this.biomes, (byte)-1);
}
@ -110,6 +118,8 @@ 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
@ -124,29 +134,110 @@ public class Chunk {
return this.height[z << 4 | x];
}
public int getTopSegment() {
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) {
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;
}
return 0;
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;
}
public int getBottomSegment() {
return this.bottom;
}
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 h = this.getTopSegment();
int top = this.getTopSegment();
int bottom = this.getBottomSegment();
this.minHeight = Integer.MAX_VALUE;
for(int x = 0; x < 16; ++x) {
for(int z = 0; z < 16; ++z) {
this.precHeight[x + (z << 4)] = -999;
this.precHeight[x + (z << 4)] = -99999999;
for(int y = h + 16; y > 0; --y) {
for(int y = top + 16; y > bottom; --y) {
Block block = this.getBlock0(x, y - 1, z);
if(block.getLightOpacity() != 0) {
@ -166,14 +257,15 @@ public class Chunk {
}
public void genSkyLight() {
int h = this.getTopSegment();
int top = this.getTopSegment();
int bottom = this.getBottomSegment();
this.minHeight = Integer.MAX_VALUE;
for(int x = 0; x < 16; ++x) {
for(int z = 0; z < 16; ++z) {
this.precHeight[x + (z << 4)] = -999;
this.precHeight[x + (z << 4)] = -99999999;
for(int y = h + 16; y > 0; --y) {
for(int y = top + 16; y > bottom; --y) {
if(this.getOpacity(x, y - 1, z) != 0) {
this.height[z << 4 | x] = y;
@ -185,9 +277,9 @@ public class Chunk {
}
}
if(!this.world.dimension.hasNoLight()) {
if(!this.world.dimension.hasNoLight() && top != Integer.MIN_VALUE) {
int l = 15;
int y = h + 16 - 1;
int y = top + 16 - 1;
while(true) {
int b = this.getOpacity(x, y, z);
@ -199,7 +291,7 @@ public class Chunk {
l -= b;
if(l > 0) {
BlockArray stor = this.blocks[y >> 4];
BlockArray stor = this.getArray(y >> 4);
if(stor != null) {
stor.setSky(x, y & 15, z, l);
@ -209,7 +301,7 @@ public class Chunk {
--y;
if(y <= 0 || l <= 0) {
if(y <= bottom || l <= 0) {
break;
}
}
@ -285,14 +377,15 @@ public class Chunk {
}
private void relightBlock(int x, int y, int z) {
int h = this.height[z << 4 | x] & 511;
int h = this.height[z << 4 | x];
int min = this.getBottomSegment();
int cy = h;
if(y > h) {
cy = y;
}
while(cy > 0 && this.getOpacity(x, cy - 1, z) == 0) {
while(cy > min && this.getOpacity(x, cy - 1, z) == 0) {
--cy;
}
@ -305,7 +398,7 @@ public class Chunk {
if(!this.world.dimension.hasNoLight()) {
if(cy < h) {
for(int n = cy; n < h; ++n) {
BlockArray stor = this.blocks[n >> 4];
BlockArray stor = this.getArray(n >> 4);
if(stor != null) {
stor.setSky(x, n & 15, z, 15);
@ -315,7 +408,7 @@ public class Chunk {
}
else {
for(int n = h; n < cy; ++n) {
BlockArray stor = this.blocks[n >> 4];
BlockArray stor = this.getArray(n >> 4);
if(stor != null) {
stor.setSky(x, n & 15, z, 0);
@ -326,7 +419,7 @@ public class Chunk {
int l = 15;
while(cy > 0 && l > 0) {
while(cy > min && l > 0) {
--cy;
int b = this.getOpacity(x, cy, z);
@ -340,7 +433,7 @@ public class Chunk {
l = 0;
}
BlockArray stor = this.blocks[cy >> 4];
BlockArray stor = this.getArray(cy >> 4);
if(stor != null) {
stor.setSky(x, cy & 15, z, l);
@ -382,65 +475,44 @@ public class Chunk {
}
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];
if(stor != null) {
block = stor.getBlock(x, y & 15, z);
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;
}
return block;
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;
}
public Block getBlock(BlockPos pos) {
return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
return y < 0 ? this.fillerBlock : Blocks.air;
}
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());
}
State state = pos.getY() == 1 ? DebugStates.getState(pos.getX(), pos.getZ()) : null;
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 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 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 Block getBlock(BlockPos pos) {
return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
}
public State setState(BlockPos pos, State state) {
@ -450,7 +522,7 @@ public class Chunk {
int o = z << 4 | x;
if(y >= this.precHeight[o] - 1) {
this.precHeight[o] = -999;
this.precHeight[o] = -99999999;
}
int h = this.height[o];
@ -462,7 +534,7 @@ public class Chunk {
else {
Block block = state.getBlock();
Block oldb = old.getBlock();
BlockArray stor = this.blocks[y >> 4];
BlockArray stor = this.getArray(y >> 4);
boolean up = false;
if(stor == null) {
@ -470,7 +542,8 @@ public class Chunk {
return null;
}
stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
this.setArray(y >> 4, stor);
up = y >= h;
}
@ -526,7 +599,7 @@ public class Chunk {
TileEntity tile = this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK);
if(tile == null) {
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world, block.getMetaFromState(state));
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world);
this.world.setTileEntity(pos, tile);
}
@ -545,7 +618,7 @@ public class Chunk {
int x = pos.getX() & 15;
int y = pos.getY();
int z = pos.getZ() & 15;
BlockArray stor = this.blocks[y >> 4];
BlockArray stor = this.getArray(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));
@ -555,10 +628,11 @@ public class Chunk {
int x = pos.getX() & 15;
int y = pos.getY();
int z = pos.getZ() & 15;
BlockArray stor = this.blocks[y >> 4];
BlockArray stor = this.getArray(y >> 4);
if(stor == null) {
stor = this.blocks[y >> 4] = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight());
this.setArray(y >> 4, stor);
this.genSkyLight();
}
@ -578,7 +652,7 @@ public class Chunk {
int x = pos.getX() & 15;
int y = pos.getY();
int z = pos.getZ() & 15;
BlockArray stor = this.blocks[y >> 4];
BlockArray stor = this.getArray(y >> 4);
if(stor == null) {
return !this.world.dimension.hasNoLight() && amount < LightType.SKY.defValue
@ -647,7 +721,7 @@ public class Chunk {
private TileEntity createNewTileEntity(BlockPos pos) {
Block block = this.getBlock(pos);
return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.world, this.getMeta(pos));
return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.world);
}
public TileEntity getTileEntity(BlockPos pos, TileEntity.EnumCreateEntityType type) {
@ -805,12 +879,13 @@ public class Chunk {
int o = x | z << 4;
BlockPos loc = new BlockPos(pos.getX(), this.precHeight[o], pos.getZ());
if(loc.getY() == -999) {
if(loc.getY() == -99999999) {
int y = this.getTopSegment() + 15;
int min = this.getBottomSegment();
loc = new BlockPos(pos.getX(), y, pos.getZ());
int h = -1;
while(loc.getY() > 0 && h == -1) {
while(loc.getY() > min && h == -1) {
Block block = this.getBlock(loc);
Material mat = block.getMaterial();
@ -861,16 +936,8 @@ 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.blocks[y >> 4];
BlockArray stor = this.getArray(y >> 4);
if(stor != null && !stor.isEmpty()) {
return false;
@ -880,7 +947,7 @@ public class Chunk {
return true;
}
public void setStorage(BlockArray[] arrays) {
public void setStorage(BlockArray[] arrays, BlockArray[] down, BlockArray[] up) {
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);
@ -889,10 +956,14 @@ 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, boolean biomes) {
public void setData(byte[] data, int update, int[] extend, boolean biomes) {
int pos = 0;
boolean sky = !this.world.dimension.hasNoLight();
@ -913,6 +984,23 @@ 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) {
@ -921,6 +1009,14 @@ 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) {
@ -930,6 +1026,14 @@ 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) {
@ -937,11 +1041,20 @@ public class Chunk {
// 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;
@ -996,11 +1109,14 @@ public class Chunk {
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
for(int n = 0; n < 8; ++n) {
if(this.lightChecks >= 8192)
if(this.top == Integer.MIN_VALUE)
return;
int h = 1 + this.top - this.bottom;
if(this.lightChecks >= 256 * h)
return;
int s = this.lightChecks % 31;
int x = this.lightChecks / 31 % 16;
int s = (this.lightChecks % h) + this.bottom;
int x = this.lightChecks / h % 16;
int z = this.lightChecks / 512;
++this.lightChecks;
@ -1008,8 +1124,9 @@ 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;
if(this.blocks[s] == null && edge || this.blocks[s] != null
&& this.blocks[s].getBlock(x, y, z).getMaterial() == Material.air) {
BlockArray arr = this.getArray(s);
if(arr == null && edge || arr != null
&& arr.getBlock(x, y, z).getMaterial() == Material.air) {
for(Facing face : Facing.values()) {
BlockPos side = block.offset(face);
@ -1092,11 +1209,12 @@ 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 > 0 && !below; --y) {
for(int y = top + 16 - 1; y > this.world.getSeaLevel() || y > bottom && !below; --y) {
pos.set(pos.getX(), y, pos.getZ());
int o = this.getOpacity(pos);
@ -1112,7 +1230,7 @@ public class Chunk {
}
}
for(int y = pos.getY(); y > 0; --y) {
for(int y = pos.getY(); y > bottom; --y) {
pos.set(pos.getX(), y, pos.getZ());
if(this.getBlock(pos).getLightValue() > 0) {

View file

@ -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 HEIGHT = 512;
public static final int MAX_SIZE_Y = 4096;
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() >= 0 && pos.getY() < 512;
pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y;
}
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 >= 0 && yStart < 512) {
if(yEnd >= -MAX_SIZE_Y && yStart < MAX_SIZE_Y) {
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() < 0) {
if(pos.getY() < -MAX_SIZE_Y) {
return 0;
}
else {
if(pos.getY() >= 512) {
pos = new BlockPos(pos.getX(), 511, pos.getZ());
if(pos.getY() >= MAX_SIZE_Y) {
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, 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() < 0) {
else if(pos.getY() < -MAX_SIZE_Y) {
return 0;
}
else {
if(pos.getY() >= 512) {
pos = new BlockPos(pos.getX(), 511, pos.getZ());
if(pos.getY() >= MAX_SIZE_Y) {
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, pos.getZ());
}
Chunk chunk = this.getChunk(pos);
@ -442,8 +442,8 @@ public abstract class World implements IWorldAccess {
return 0;
}
else {
if(pos.getY() < 0) {
pos = new BlockPos(pos.getX(), 0, pos.getZ());
if(pos.getY() < -MAX_SIZE_Y) {
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, 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() < 0) {
pos = new BlockPos(pos.getX(), 0, pos.getZ());
if(pos.getY() < -MAX_SIZE_Y) {
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
}
if(!isValid(pos)) {
@ -1593,7 +1593,7 @@ public abstract class World implements IWorldAccess {
return true;
}
else {
if(pos.getY() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) {
if(pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y && this.getLightFor(LightType.BLOCK, pos) < 10) {
Block block = this.getState(pos).getBlock();
if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer))

View file

@ -41,8 +41,6 @@ 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

View file

@ -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, 0.0, (double)World.HEIGHT, false),
new DoubleParser("y", defaulted ? DefType.Y : null, (double)(-World.MAX_SIZE_Y), (double)World.MAX_SIZE_Y, false),
new DoubleParser("z", defaulted ? DefType.Z : null, (double)(-World.MAX_SIZE), (double)World.MAX_SIZE, centered));
}

View file

@ -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, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 512, chunkcoordintpair.z * 16 + 16));
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));
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));
this.sendPacket(new SPacketChunkData((Chunk)list.get(0), true, 0xffffffff, null));
}
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() == -999.0D)
if (packetIn.isMoving() && packetIn.getPositionY() == -99999999.0D)
{
packetIn.setMoving(false);
}
@ -2281,7 +2281,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
{
return;
}
else if (blockpos.getY() >= World.HEIGHT)
else if (blockpos.getY() >= World.MAX_SIZE_Y)
{
return;
}
@ -2345,7 +2345,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
this.tryUseItem(itemstack);
// }
}
else if (blockpos.getY() < World.HEIGHT - 1 || enumfacing != Facing.UP && blockpos.getY() < World.HEIGHT)
else if (blockpos.getY() < World.MAX_SIZE_Y - 1 || enumfacing != Facing.UP && blockpos.getY() < World.MAX_SIZE_Y)
{
double max = this.entity.getReachDistance() + 3.0D;
max *= max;

View file

@ -376,12 +376,22 @@ 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.getByte("Y");
int y = sect.getInteger("Y");
BlockArray storage = new BlockArray(y << 4, light);
byte[] blocks = sect.getByteArray("Blocks");
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
@ -404,10 +414,15 @@ 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;
}
chunk.setStorage(sections);
chunk.setStorage(sections, down, up);
if(tag.hasKey("Biomes", 7)) {
chunk.setBiomes(tag.getByteArray("Biomes"));
@ -495,13 +510,18 @@ 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 storage : sections) {
for(BlockArray[] sec : new BlockArray[][] {sections, down, up}) {
if(sec == null)
continue;
for(BlockArray storage : sec) {
if(storage != null) {
NBTTagCompound sect = new NBTTagCompound();
sect.setByte("Y", (byte)(storage.getY() >> 4 & 511));
sect.setInteger("Y", storage.getY() >> 4);
byte[] blocks = new byte[storage.getData().length];
NibbleArray data = new NibbleArray();
NibbleArray adddata = null;
@ -543,6 +563,7 @@ public class Region {
sects.appendTag(sect);
}
}
}
tag.setTag("Sections", sects);
tag.setByteArray("Biomes", chunk.getBiomes());

View file

@ -90,13 +90,10 @@ 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.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);
int h = chunk.getTopSegment();
if(h == Integer.MIN_VALUE)
continue;
int y = world.rand.range(chunk.getBottomSegment(), h + 16);
BlockPos pos = new BlockPos(x, y, z);
Block block = world.getState(pos).getBlock();
if(!block.isNormalCube()) {

View file

@ -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.HEIGHT, blockpos.getZ()))).expand(3.0D,
BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.MAX_SIZE_Y, 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() >= 0 && pos.getY() < 512) {
if(pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) {
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() >= 0 && pos.getY() < 512 && this.getLightFor(LightType.BLOCK, pos) < 10) {
if(pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y && this.getLightFor(LightType.BLOCK, pos) < 10) {
State iblockstate = this.getState(pos);
Block block = iblockstate.getBlock();
@ -2437,8 +2437,9 @@ 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()); blockpos.getY() >= 0; blockpos = blockpos1) {
for(blockpos = new BlockPos(pos.getX(), chunk.getTopSegment() + 16, pos.getZ()), bottom = chunk.getBottomSegment(); blockpos.getY() >= bottom; blockpos = blockpos1) {
blockpos1 = blockpos.down();
Material material = chunk.getBlock(blockpos1).getMaterial();
@ -2802,8 +2803,10 @@ 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;
@ -2834,7 +2837,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));
player.connection.sendPacket(new SPacketChunkData(chunk, true, 0, new int[0]));
}
this.watching.remove(player);
@ -2877,10 +2880,13 @@ 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);
if(this.updates < 64) {
int pos = x << 13 | z << 9 | y;
long pos = ((long)x & 4294967295L) << 36 | ((long)z & 4294967295L) << 32 | (y & 4294967295L);
for(int i = 0; i < this.updates; ++i) {
if(this.changes[i] == pos) {
@ -2905,9 +2911,9 @@ public final class WorldServer extends AWorldServer {
public void onUpdate() {
if(this.updates != 0) {
if(this.updates == 1) {
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;
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;
BlockPos pos = new BlockPos(x, y, z);
this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos));
@ -2918,14 +2924,39 @@ 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));
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);
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) {
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));
}
@ -2937,9 +2968,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 = (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;
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;
BlockPos pos = new BlockPos(x, y, z);
if(WorldServer.this.getState(pos).getBlock().hasTileEntity()) {
@ -2950,6 +2981,7 @@ public final class WorldServer extends AWorldServer {
this.updates = 0;
this.sections = 0;
this.extend.clear();
this.biomes = false;
}
}