make world taller
This commit is contained in:
parent
3a5a29cf9e
commit
caef42dc16
49 changed files with 489 additions and 291 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);
|
// 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 chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
||||||
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes());
|
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.getExtractedExtend(), packetIn.hasBiomes());
|
||||||
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);
|
||||||
|
|
||||||
if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
|
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);
|
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
|
||||||
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
||||||
chunk.setBiomes(packetIn.getBiomes());
|
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.doPreChunk(j, k, true);
|
||||||
// this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
|
// this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
|
||||||
Chunk chunk = this.clientWorldController.getChunk(j, k);
|
Chunk chunk = this.clientWorldController.getChunk(j, k);
|
||||||
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true);
|
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), packetIn.getChunkExtend(i), true);
|
||||||
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
|
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
|
if (this.clientWorldController.dimension.hasNoLight()) // TODO: check
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
||||||
|
|
||||||
private State getBlockStateRaw(BlockPos pos)
|
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 i = (pos.getX() >> 4) - this.chunkX;
|
||||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||||
|
@ -136,7 +136,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
|
||||||
{
|
{
|
||||||
return 0;
|
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())
|
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)
|
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 i = (pos.getX() >> 4) - this.chunkX;
|
||||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||||
|
|
|
@ -53,6 +53,7 @@ import common.util.Vec3;
|
||||||
import common.util.Vector3f;
|
import common.util.Vector3f;
|
||||||
import common.world.Chunk;
|
import common.world.Chunk;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
import common.world.World;
|
||||||
|
|
||||||
public class RenderGlobal
|
public class RenderGlobal
|
||||||
{
|
{
|
||||||
|
@ -632,7 +633,7 @@ public class RenderGlobal
|
||||||
|
|
||||||
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
|
// 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 */)) {
|
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 /* || flag3 */)) {
|
||||||
++this.countEntitiesRendered;
|
++this.countEntitiesRendered;
|
||||||
|
@ -931,7 +932,7 @@ public class RenderGlobal
|
||||||
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(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)
|
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
|
||||||
|
|
|
@ -19,14 +19,12 @@ public class EmptyChunk extends Chunk {
|
||||||
private final int liquidY;
|
private final int liquidY;
|
||||||
private final State liquid;
|
private final State liquid;
|
||||||
private final Block liquidBlock;
|
private final Block liquidBlock;
|
||||||
private final int liquidMeta;
|
|
||||||
|
|
||||||
public EmptyChunk(WorldClient world) {
|
public EmptyChunk(WorldClient world) {
|
||||||
super(world, 0, 0);
|
super(world, 0, 0);
|
||||||
this.liquidY = world.dimension.getSeaLevel() - 1;
|
this.liquidY = world.dimension.getSeaLevel() - 1;
|
||||||
this.liquid = world.dimension.getLiquid();
|
this.liquid = world.dimension.getLiquid();
|
||||||
this.liquidBlock = this.liquid.getBlock();
|
this.liquidBlock = this.liquid.getBlock();
|
||||||
this.liquidMeta = this.liquidBlock.getMetaFromState(this.liquid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight(int x, int z) {
|
public int getHeight(int x, int z) {
|
||||||
|
@ -107,7 +105,7 @@ public class EmptyChunk extends Chunk {
|
||||||
return true;
|
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) {
|
public Biome getBiome(BlockPos pos, BiomeGenerator gen) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ import common.util.BlockPos.MutableBlockPos;
|
||||||
import common.world.Chunk;
|
import common.world.Chunk;
|
||||||
import common.world.AWorldClient;
|
import common.world.AWorldClient;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
import common.world.World;
|
||||||
|
|
||||||
public class WorldClient extends AWorldClient
|
public class WorldClient extends AWorldClient
|
||||||
{
|
{
|
||||||
|
@ -80,14 +81,14 @@ public class WorldClient extends AWorldClient
|
||||||
this.chunkMapping.add(id, this.emptyChunk);
|
this.chunkMapping.add(id, this.emptyChunk);
|
||||||
this.emptyChunkListing.remove(id);
|
this.emptyChunkListing.remove(id);
|
||||||
this.nextEmptyChunkListing.add(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) {
|
for(Long id : this.emptyChunkListing) {
|
||||||
this.chunkMapping.remove(id);
|
this.chunkMapping.remove(id);
|
||||||
int x = LongHashMap.getX(id);
|
int x = LongHashMap.getX(id);
|
||||||
int z = LongHashMap.getZ(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.clear();
|
||||||
this.emptyChunkListing.addAll(this.nextEmptyChunkListing);
|
this.emptyChunkListing.addAll(this.nextEmptyChunkListing);
|
||||||
|
@ -184,7 +185,7 @@ public class WorldClient extends AWorldClient
|
||||||
|
|
||||||
if (!load)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
* 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();
|
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.
|
* 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();
|
return new TileEntityBeacon();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class BlockBlueShroom extends BlockBush
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
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());
|
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()));
|
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.
|
* 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();
|
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.
|
* 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();
|
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.
|
* 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();
|
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.
|
* 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();
|
return new TileEntityDispenser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ public class BlockDoor extends Block
|
||||||
|
|
||||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
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()
|
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.
|
* 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();
|
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.
|
* 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();
|
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.
|
* 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();
|
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.
|
* 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();
|
return new TileEntityHopper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class BlockLilyPad extends BlockBush
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
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());
|
State iblockstate = worldIn.getState(pos.down());
|
||||||
return (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
|
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);
|
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) {
|
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) {
|
||||||
this.updateState(worldIn, pos, 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.
|
* 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();
|
return new TileEntityMobSpawner();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
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());
|
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()));
|
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.
|
* 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();
|
return new TileEntityNote();
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,9 +548,9 @@ public class BlockPistonBase extends Block
|
||||||
{
|
{
|
||||||
return false;
|
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)
|
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.
|
* 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
|
||||||
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
|
||||||
{
|
{
|
||||||
super.onBlockAdded(worldIn, pos, 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)
|
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.
|
* 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();
|
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.
|
* 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();
|
return new TileEntitySign();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
public TileEntity createNewTileEntity(World worldIn)
|
||||||
{
|
{
|
||||||
return new TileEntitySkull();
|
return new TileEntitySkull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class BlockTianReactor extends BlockMachine {
|
public class BlockTianReactor extends BlockMachine {
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
public TileEntity createNewTileEntity(World worldIn) {
|
||||||
return new TileEntityTianReactor();
|
return new TileEntityTianReactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class BlockVine extends Block
|
||||||
Facing enumfacing1 = Facing.random(rand);
|
Facing enumfacing1 = Facing.random(rand);
|
||||||
BlockPos blockpos1 = pos.up();
|
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)
|
if (!flag)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,5 @@ import common.world.World;
|
||||||
|
|
||||||
public interface ITileEntityProvider
|
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,6 +975,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
||||||
this.seed = tag.getLong("Seed");
|
this.seed = tag.getLong("Seed");
|
||||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
this.seaLevel = tag.getInteger("SeaLevel");
|
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());
|
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.defaultWeather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
|
||||||
this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves"));
|
this.defaultLeaves = LeavesType.getByName(tag.getString("DefaultLeaves"));
|
||||||
this.defaultLeaves = this.defaultLeaves == null ? LeavesType.SPRING : this.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.top = BlockRegistry.getFromIdName(tag.getString("TopBlock"), Blocks.dirt.getState());
|
||||||
this.surface = BlockRegistry.getFromIdName(tag.getString("SurfaceBlock"), Blocks.grass.getState());
|
this.surface = BlockRegistry.getFromIdName(tag.getString("SurfaceBlock"), Blocks.grass.getState());
|
||||||
this.alt1 = BlockRegistry.getFromIdName(tag.getString("AltBlock1"), Blocks.gravel.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);
|
tag.setLong("Seed", this.seed);
|
||||||
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
if(partialGen || all || this.id >= UniverseRegistry.MORE_DIM_ID) {
|
||||||
tag.setInteger("SeaLevel", this.seaLevel);
|
tag.setInteger("SeaLevel", this.seaLevel);
|
||||||
|
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
||||||
tag.setString("LiquidBlock", BlockRegistry.toIdName(this.liquid));
|
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.setBoolean("SemiFixed", this.semiFixed);
|
||||||
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
||||||
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
||||||
tag.setString("FillerBlock", BlockRegistry.toIdName(this.filler));
|
|
||||||
tag.setString("TopBlock", BlockRegistry.toIdName(this.top));
|
tag.setString("TopBlock", BlockRegistry.toIdName(this.top));
|
||||||
tag.setString("SurfaceBlock", BlockRegistry.toIdName(this.surface));
|
tag.setString("SurfaceBlock", BlockRegistry.toIdName(this.surface));
|
||||||
tag.setString("AltBlock1", BlockRegistry.toIdName(this.alt1));
|
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() < 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)
|
if (this.shouldDropItem && Config.objectDrop)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2684,7 +2684,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
}
|
}
|
||||||
else
|
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;
|
flag2 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ItemBucket extends Item
|
||||||
private final BlockDynamicLiquid liquid;
|
private final BlockDynamicLiquid liquid;
|
||||||
|
|
||||||
private static boolean test(AWorldServer world, BlockPos pos, Set<Block> blocks, int max, BlockPos origin, int radius) {
|
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;
|
return false;
|
||||||
if(pos.getX() < origin.getX() - radius || pos.getX() > origin.getX() + radius)
|
if(pos.getX() < origin.getX() - radius || pos.getX() > origin.getX() + radius)
|
||||||
return false;
|
return false;
|
||||||
|
@ -54,7 +54,7 @@ public class ItemBucket extends Item
|
||||||
List<Vec3i> dirs = new ArrayList<Vec3i>();
|
List<Vec3i> dirs = new ArrayList<Vec3i>();
|
||||||
Set<Block> blocks = liquid == null ? null : Sets.newHashSet(FluidRegistry.getDynamicBlock(liquid), liquid, Blocks.air);
|
Set<Block> blocks = liquid == null ? null : Sets.newHashSet(FluidRegistry.getDynamicBlock(liquid), liquid, Blocks.air);
|
||||||
State state = (liquid == null ? Blocks.air : liquid).getState();
|
State state = (liquid == null ? Blocks.air : liquid).getState();
|
||||||
int max = 511;
|
int max = World.MAX_SIZE_Y - 1;
|
||||||
|
|
||||||
if(liquid != null) {
|
if(liquid != null) {
|
||||||
dirs.add(new Vec3i(1, 0, 0));
|
dirs.add(new Vec3i(1, 0, 0));
|
||||||
|
|
|
@ -58,16 +58,14 @@ public class PacketBuffer
|
||||||
|
|
||||||
public BlockPos readBlockPos()
|
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)
|
public void writeBlockPos(BlockPos pos)
|
||||||
{
|
{
|
||||||
this.writeLong(pos.toLong());
|
this.writeInt(pos.getX());
|
||||||
// this.writeInt(pos.getX());
|
this.writeInt(pos.getY());
|
||||||
// this.writeInt(pos.getY());
|
this.writeInt(pos.getZ());
|
||||||
// this.writeInt(pos.getZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Text readChatComponent() throws IOException
|
// public Text readChatComponent() throws IOException
|
||||||
|
|
|
@ -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.chunkX = chunkIn.xPos;
|
||||||
this.chunkZ = chunkIn.zPos;
|
this.chunkZ = chunkIn.zPos;
|
||||||
this.biomes = biomes;
|
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 = new SPacketChunkData.Extracted();
|
||||||
this.extractedData.dataSize = buf.readInt();
|
this.extractedData.dataSize = buf.readInt();
|
||||||
this.extractedData.data = buf.readByteArray();
|
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.writeBoolean(this.biomes);
|
||||||
buf.writeInt(this.extractedData.dataSize);
|
buf.writeInt(this.extractedData.dataSize);
|
||||||
buf.writeByteArray(this.extractedData.data);
|
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;
|
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[] aextendedblockstorage = chunk.getStorage();
|
||||||
|
BlockArray[] down = chunk.getStorageDown();
|
||||||
|
BlockArray[] up = chunk.getStorageUp();
|
||||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = new SPacketChunkData.Extracted();
|
SPacketChunkData.Extracted s21packetchunkdata$extracted = new SPacketChunkData.Extracted();
|
||||||
List<BlockArray> list = Lists.<BlockArray>newArrayList();
|
List<BlockArray> list = Lists.<BlockArray>newArrayList();
|
||||||
|
|
||||||
|
@ -92,8 +102,37 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
||||||
list.add(extendedblockstorage);
|
list.add(extendedblockstorage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int epos = list.size();
|
||||||
s21packetchunkdata$extracted.data = new byte[getSize(Integer.bitCount(s21packetchunkdata$extracted.dataSize), overworld, biomes)];
|
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)];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
for (BlockArray extendedblockstorage1 : list)
|
for (BlockArray extendedblockstorage1 : list)
|
||||||
|
@ -149,6 +188,11 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
||||||
return this.extractedData.dataSize;
|
return this.extractedData.dataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] getExtractedExtend()
|
||||||
|
{
|
||||||
|
return this.extractedData.extend;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBiomes()
|
public boolean hasBiomes()
|
||||||
{
|
{
|
||||||
return this.biomes;
|
return this.biomes;
|
||||||
|
@ -158,5 +202,6 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
||||||
{
|
{
|
||||||
public byte[] data;
|
public byte[] data;
|
||||||
public int dataSize;
|
public int dataSize;
|
||||||
|
public int[] extend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
||||||
for (int j = 0; j < i; ++j)
|
for (int j = 0; j < i; ++j)
|
||||||
{
|
{
|
||||||
Chunk chunk = (Chunk)chunks.get(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.xPositions[j] = chunk.xPos;
|
||||||
this.zPositions[j] = chunk.zPos;
|
this.zPositions[j] = chunk.zPos;
|
||||||
this.chunksData[j] = s21packetchunkdata$extracted;
|
this.chunksData[j] = s21packetchunkdata$extracted;
|
||||||
|
@ -54,7 +54,11 @@ public class SPacketMapChunkBulk implements Packet<IClientPlayer>
|
||||||
this.zPositions[j] = buf.readInt();
|
this.zPositions[j] = buf.readInt();
|
||||||
this.chunksData[j] = new SPacketChunkData.Extracted();
|
this.chunksData[j] = new SPacketChunkData.Extracted();
|
||||||
this.chunksData[j].dataSize = buf.readInt();
|
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)
|
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.xPositions[i]);
|
||||||
buf.writeInt(this.zPositions[i]);
|
buf.writeInt(this.zPositions[i]);
|
||||||
buf.writeInt(this.chunksData[i].dataSize);
|
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)
|
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;
|
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_, int[] crammedPositionsIn, Chunk chunkIn)
|
public SPacketMultiBlockChange(int p_i45181_1_, long[] crammedPositionsIn, Chunk chunkIn)
|
||||||
{
|
{
|
||||||
this.chunkPosCoord = new ChunkPos(chunkIn.xPos, chunkIn.zPos);
|
this.chunkPosCoord = new ChunkPos(chunkIn.xPos, chunkIn.zPos);
|
||||||
this.changedBlocks = new SPacketMultiBlockChange.BlockUpdateData[p_i45181_1_];
|
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)
|
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)
|
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()));
|
buf.writeVarIntToBuffer(BlockRegistry.STATEMAP.get(s22packetmultiblockchange$blockupdatedata.getBlockState()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,16 +76,16 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
||||||
|
|
||||||
public class BlockUpdateData
|
public class BlockUpdateData
|
||||||
{
|
{
|
||||||
private final int position;
|
private final long position;
|
||||||
private final State blockState;
|
private final State blockState;
|
||||||
|
|
||||||
public BlockUpdateData(int raw, State state)
|
public BlockUpdateData(long raw, State state)
|
||||||
{
|
{
|
||||||
this.position = raw;
|
this.position = raw;
|
||||||
this.blockState = state;
|
this.blockState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockUpdateData(int raw, Chunk chunkIn)
|
public BlockUpdateData(long raw, Chunk chunkIn)
|
||||||
{
|
{
|
||||||
this.position = raw;
|
this.position = raw;
|
||||||
this.blockState = chunkIn.getState(this.getPos());
|
this.blockState = chunkIn.getState(this.getPos());
|
||||||
|
@ -93,11 +93,11 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
|
||||||
|
|
||||||
public BlockPos getPos()
|
public BlockPos getPos()
|
||||||
{
|
{
|
||||||
ChunkPos r = SPacketMultiBlockChange.this.chunkPosCoord;
|
ChunkPos pos = 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)));
|
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;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class PathCache extends ChunkCache implements IBlockAccess
|
||||||
|
|
||||||
public State getState(BlockPos pos)
|
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 i = (pos.getX() >> 4) - this.chunkX;
|
||||||
int j = (pos.getZ() >> 4) - this.chunkZ;
|
int j = (pos.getZ() >> 4) - this.chunkZ;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable
|
||||||
int j = this.pos.getX();
|
int j = this.pos.getX();
|
||||||
int k = this.pos.getY();
|
int k = this.pos.getY();
|
||||||
int l = this.pos.getZ();
|
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);
|
List<EntityLiving> list = this.worldObj.<EntityLiving>getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
|
||||||
|
|
||||||
for (EntityLiving entityplayer : list)
|
for (EntityLiving entityplayer : list)
|
||||||
|
|
|
@ -8,14 +8,6 @@ import common.entity.Entity;
|
||||||
public class BlockPos extends Vec3i
|
public class BlockPos extends Vec3i
|
||||||
{
|
{
|
||||||
public static final BlockPos ORIGIN = new BlockPos(0, 0, 0);
|
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)
|
public BlockPos(int x, int y, int z)
|
||||||
{
|
{
|
||||||
|
@ -193,19 +185,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());
|
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)
|
public static Iterable<BlockPos> getAllInBox(BlockPos from, BlockPos to)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class Chunk {
|
||||||
public final int xPos;
|
public final int xPos;
|
||||||
public final int zPos;
|
public final int zPos;
|
||||||
private final World world;
|
private final World world;
|
||||||
|
private final State filler;
|
||||||
|
private final Block fillerBlock;
|
||||||
private final BlockArray[] blocks = new BlockArray[32];
|
private final BlockArray[] blocks = new BlockArray[32];
|
||||||
private final byte[] biomes = new byte[256];
|
private final byte[] biomes = new byte[256];
|
||||||
private final int[] precHeight = new int[256];
|
private final int[] precHeight = new int[256];
|
||||||
|
@ -48,18 +50,24 @@ public class Chunk {
|
||||||
private boolean modified;
|
private boolean modified;
|
||||||
private boolean hasEntity;
|
private boolean hasEntity;
|
||||||
private int minHeight;
|
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 lastSave;
|
||||||
private long inhabited;
|
private long inhabited;
|
||||||
|
private BlockArray[] extendDown;
|
||||||
|
private BlockArray[] extendUp;
|
||||||
|
|
||||||
public Chunk(World world, int x, int z) {
|
public Chunk(World world, int x, int z) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.xPos = x;
|
this.xPos = x;
|
||||||
this.zPos = z;
|
this.zPos = z;
|
||||||
|
this.filler = world.dimension.getFiller();
|
||||||
|
this.fillerBlock = this.filler.getBlock();
|
||||||
for(int y = 0; y < this.entities.length; ++y) {
|
for(int y = 0; y < this.entities.length; ++y) {
|
||||||
this.entities[y] = new ClassInheritanceMultiMap(Entity.class);
|
this.entities[y] = new ClassInheritanceMultiMap(Entity.class);
|
||||||
}
|
}
|
||||||
Arrays.fill(this.precHeight, -999);
|
Arrays.fill(this.precHeight, -99999999);
|
||||||
Arrays.fill(this.biomes, (byte)-1);
|
Arrays.fill(this.biomes, (byte)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +118,8 @@ public class Chunk {
|
||||||
for(int n = 0; n < this.biomes.length; ++n) {
|
for(int n = 0; n < this.biomes.length; ++n) {
|
||||||
this.biomes[n] = (byte)biomes[n].id;
|
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)
|
if(ceil == null)
|
||||||
this.genSkyLight();
|
this.genSkyLight();
|
||||||
else
|
else
|
||||||
|
@ -124,29 +134,110 @@ public class Chunk {
|
||||||
return this.height[z << 4 | x];
|
return this.height[z << 4 | x];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTopSegment() {
|
private int findTopSegment() {
|
||||||
for(int y = this.blocks.length - 1; y >= 0; --y) {
|
if(this.extendUp != null) {
|
||||||
if(this.blocks[y] != null) {
|
for(int y = this.extendUp.length - 1; y >= 0; --y) {
|
||||||
return this.blocks[y].getY();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
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() {
|
public BlockArray[] getStorage() {
|
||||||
return this.blocks;
|
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() {
|
protected void genHeights() {
|
||||||
int h = this.getTopSegment();
|
int top = this.getTopSegment();
|
||||||
|
int bottom = this.getBottomSegment();
|
||||||
this.minHeight = Integer.MAX_VALUE;
|
this.minHeight = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for(int x = 0; x < 16; ++x) {
|
for(int x = 0; x < 16; ++x) {
|
||||||
for(int z = 0; z < 16; ++z) {
|
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);
|
Block block = this.getBlock0(x, y - 1, z);
|
||||||
|
|
||||||
if(block.getLightOpacity() != 0) {
|
if(block.getLightOpacity() != 0) {
|
||||||
|
@ -166,14 +257,15 @@ public class Chunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genSkyLight() {
|
public void genSkyLight() {
|
||||||
int h = this.getTopSegment();
|
int top = this.getTopSegment();
|
||||||
|
int bottom = this.getBottomSegment();
|
||||||
this.minHeight = Integer.MAX_VALUE;
|
this.minHeight = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for(int x = 0; x < 16; ++x) {
|
for(int x = 0; x < 16; ++x) {
|
||||||
for(int z = 0; z < 16; ++z) {
|
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) {
|
if(this.getOpacity(x, y - 1, z) != 0) {
|
||||||
this.height[z << 4 | x] = y;
|
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 l = 15;
|
||||||
int y = h + 16 - 1;
|
int y = top + 16 - 1;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
int b = this.getOpacity(x, y, z);
|
int b = this.getOpacity(x, y, z);
|
||||||
|
@ -199,7 +291,7 @@ public class Chunk {
|
||||||
l -= b;
|
l -= b;
|
||||||
|
|
||||||
if(l > 0) {
|
if(l > 0) {
|
||||||
BlockArray stor = this.blocks[y >> 4];
|
BlockArray stor = this.getArray(y >> 4);
|
||||||
|
|
||||||
if(stor != null) {
|
if(stor != null) {
|
||||||
stor.setSky(x, y & 15, z, l);
|
stor.setSky(x, y & 15, z, l);
|
||||||
|
@ -209,7 +301,7 @@ public class Chunk {
|
||||||
|
|
||||||
--y;
|
--y;
|
||||||
|
|
||||||
if(y <= 0 || l <= 0) {
|
if(y <= bottom || l <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,14 +377,15 @@ public class Chunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void relightBlock(int x, int y, int z) {
|
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;
|
int cy = h;
|
||||||
|
|
||||||
if(y > h) {
|
if(y > h) {
|
||||||
cy = y;
|
cy = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(cy > 0 && this.getOpacity(x, cy - 1, z) == 0) {
|
while(cy > min && this.getOpacity(x, cy - 1, z) == 0) {
|
||||||
--cy;
|
--cy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +398,7 @@ public class Chunk {
|
||||||
if(!this.world.dimension.hasNoLight()) {
|
if(!this.world.dimension.hasNoLight()) {
|
||||||
if(cy < h) {
|
if(cy < h) {
|
||||||
for(int n = cy; n < h; ++n) {
|
for(int n = cy; n < h; ++n) {
|
||||||
BlockArray stor = this.blocks[n >> 4];
|
BlockArray stor = this.getArray(n >> 4);
|
||||||
|
|
||||||
if(stor != null) {
|
if(stor != null) {
|
||||||
stor.setSky(x, n & 15, z, 15);
|
stor.setSky(x, n & 15, z, 15);
|
||||||
|
@ -315,7 +408,7 @@ public class Chunk {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(int n = h; n < cy; ++n) {
|
for(int n = h; n < cy; ++n) {
|
||||||
BlockArray stor = this.blocks[n >> 4];
|
BlockArray stor = this.getArray(n >> 4);
|
||||||
|
|
||||||
if(stor != null) {
|
if(stor != null) {
|
||||||
stor.setSky(x, n & 15, z, 0);
|
stor.setSky(x, n & 15, z, 0);
|
||||||
|
@ -326,7 +419,7 @@ public class Chunk {
|
||||||
|
|
||||||
int l = 15;
|
int l = 15;
|
||||||
|
|
||||||
while(cy > 0 && l > 0) {
|
while(cy > min && l > 0) {
|
||||||
--cy;
|
--cy;
|
||||||
int b = this.getOpacity(x, cy, z);
|
int b = this.getOpacity(x, cy, z);
|
||||||
|
|
||||||
|
@ -340,7 +433,7 @@ public class Chunk {
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockArray stor = this.blocks[cy >> 4];
|
BlockArray stor = this.getArray(cy >> 4);
|
||||||
|
|
||||||
if(stor != null) {
|
if(stor != null) {
|
||||||
stor.setSky(x, cy & 15, z, l);
|
stor.setSky(x, cy & 15, z, l);
|
||||||
|
@ -380,69 +473,48 @@ public class Chunk {
|
||||||
private int getOpacity(int x, int y, int z) {
|
private int getOpacity(int x, int y, int z) {
|
||||||
return this.getBlock0(x, y, z).getLightOpacity();
|
return this.getBlock0(x, y, z).getLightOpacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block getBlock0(int x, int y, int z) {
|
private Block getBlock0(int x, int y, int z) {
|
||||||
Block block = Blocks.air;
|
|
||||||
|
|
||||||
if(y >= 0 && y >> 4 < this.blocks.length) {
|
if(y >= 0 && y >> 4 < this.blocks.length) {
|
||||||
BlockArray stor = this.blocks[y >> 4];
|
BlockArray stor = this.blocks[y >> 4];
|
||||||
|
return stor != null ? stor.getBlock(x, y & 15, z) : Blocks.air;
|
||||||
if(stor != null) {
|
}
|
||||||
block = stor.getBlock(x, y & 15, z);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock(BlockPos pos) {
|
public Block getBlock(BlockPos pos) {
|
||||||
return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
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) {
|
public State setState(BlockPos pos, State state) {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
|
@ -450,7 +522,7 @@ public class Chunk {
|
||||||
int o = z << 4 | x;
|
int o = z << 4 | x;
|
||||||
|
|
||||||
if(y >= this.precHeight[o] - 1) {
|
if(y >= this.precHeight[o] - 1) {
|
||||||
this.precHeight[o] = -999;
|
this.precHeight[o] = -99999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
int h = this.height[o];
|
int h = this.height[o];
|
||||||
|
@ -462,7 +534,7 @@ public class Chunk {
|
||||||
else {
|
else {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
Block oldb = old.getBlock();
|
Block oldb = old.getBlock();
|
||||||
BlockArray stor = this.blocks[y >> 4];
|
BlockArray stor = this.getArray(y >> 4);
|
||||||
boolean up = false;
|
boolean up = false;
|
||||||
|
|
||||||
if(stor == null) {
|
if(stor == null) {
|
||||||
|
@ -470,7 +542,8 @@ public class Chunk {
|
||||||
return null;
|
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;
|
up = y >= h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +599,7 @@ public class Chunk {
|
||||||
TileEntity tile = this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK);
|
TileEntity tile = this.getTileEntity(pos, TileEntity.EnumCreateEntityType.CHECK);
|
||||||
|
|
||||||
if(tile == null) {
|
if(tile == null) {
|
||||||
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world, block.getMetaFromState(state));
|
tile = ((ITileEntityProvider)block).createNewTileEntity(this.world);
|
||||||
this.world.setTileEntity(pos, tile);
|
this.world.setTileEntity(pos, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +618,7 @@ public class Chunk {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ() & 15;
|
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)
|
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.SKY ? (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z))
|
||||||
: (type == LightType.BLOCK ? stor.getLight(x, y & 15, z) : type.defValue));
|
: (type == LightType.BLOCK ? stor.getLight(x, y & 15, z) : type.defValue));
|
||||||
|
@ -555,10 +628,11 @@ public class Chunk {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
BlockArray stor = this.blocks[y >> 4];
|
BlockArray stor = this.getArray(y >> 4);
|
||||||
|
|
||||||
if(stor == null) {
|
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();
|
this.genSkyLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +652,7 @@ public class Chunk {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
BlockArray stor = this.blocks[y >> 4];
|
BlockArray stor = this.getArray(y >> 4);
|
||||||
|
|
||||||
if(stor == null) {
|
if(stor == null) {
|
||||||
return !this.world.dimension.hasNoLight() && amount < LightType.SKY.defValue
|
return !this.world.dimension.hasNoLight() && amount < LightType.SKY.defValue
|
||||||
|
@ -647,7 +721,7 @@ public class Chunk {
|
||||||
|
|
||||||
private TileEntity createNewTileEntity(BlockPos pos) {
|
private TileEntity createNewTileEntity(BlockPos pos) {
|
||||||
Block block = this.getBlock(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) {
|
public TileEntity getTileEntity(BlockPos pos, TileEntity.EnumCreateEntityType type) {
|
||||||
|
@ -805,12 +879,13 @@ public class Chunk {
|
||||||
int o = x | z << 4;
|
int o = x | z << 4;
|
||||||
BlockPos loc = new BlockPos(pos.getX(), this.precHeight[o], pos.getZ());
|
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 y = this.getTopSegment() + 15;
|
||||||
|
int min = this.getBottomSegment();
|
||||||
loc = new BlockPos(pos.getX(), y, pos.getZ());
|
loc = new BlockPos(pos.getX(), y, pos.getZ());
|
||||||
int h = -1;
|
int h = -1;
|
||||||
|
|
||||||
while(loc.getY() > 0 && h == -1) {
|
while(loc.getY() > min && h == -1) {
|
||||||
Block block = this.getBlock(loc);
|
Block block = this.getBlock(loc);
|
||||||
Material mat = block.getMaterial();
|
Material mat = block.getMaterial();
|
||||||
|
|
||||||
|
@ -861,16 +936,8 @@ public class Chunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty(int bottom, int top) {
|
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) {
|
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()) {
|
if(stor != null && !stor.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -880,7 +947,7 @@ public class Chunk {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStorage(BlockArray[] arrays) {
|
public void setStorage(BlockArray[] arrays, BlockArray[] down, BlockArray[] up) {
|
||||||
if(this.blocks.length != arrays.length) {
|
if(this.blocks.length != arrays.length) {
|
||||||
Log.JNI.warn("Konnte Sektionen des Chunks nicht setzen, Länge des Arrays ist " + arrays.length + " statt "
|
Log.JNI.warn("Konnte Sektionen des Chunks nicht setzen, Länge des Arrays ist " + arrays.length + " statt "
|
||||||
+ this.blocks.length);
|
+ this.blocks.length);
|
||||||
|
@ -889,10 +956,14 @@ public class Chunk {
|
||||||
for(int n = 0; n < this.blocks.length; ++n) {
|
for(int n = 0; n < this.blocks.length; ++n) {
|
||||||
this.blocks[n] = arrays[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;
|
int pos = 0;
|
||||||
boolean sky = !this.world.dimension.hasNoLight();
|
boolean sky = !this.world.dimension.hasNoLight();
|
||||||
|
|
||||||
|
@ -913,6 +984,23 @@ public class Chunk {
|
||||||
this.blocks[n] = null;
|
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) {
|
for(int n = 0; n < this.blocks.length; ++n) {
|
||||||
if((update & 1 << n) != 0 && this.blocks[n] != null) {
|
if((update & 1 << n) != 0 && this.blocks[n] != null) {
|
||||||
|
@ -921,6 +1009,14 @@ public class Chunk {
|
||||||
pos += light.getData().length;
|
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) {
|
if(sky) {
|
||||||
for(int n = 0; n < this.blocks.length; ++n) {
|
for(int n = 0; n < this.blocks.length; ++n) {
|
||||||
|
@ -930,18 +1026,35 @@ public class Chunk {
|
||||||
pos += slight.getData().length;
|
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) {
|
if(biomes) {
|
||||||
System.arraycopy(data, pos, this.biomes, 0, this.biomes.length);
|
System.arraycopy(data, pos, this.biomes, 0, this.biomes.length);
|
||||||
// int unk = pos + 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) {
|
for(int n = 0; n < this.blocks.length; ++n) {
|
||||||
if(this.blocks[n] != null && (update & 1 << n) != 0) {
|
if(this.blocks[n] != null && (update & 1 << n) != 0) {
|
||||||
this.blocks[n].update();
|
this.blocks[n].update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(int cy : extend) {
|
||||||
|
BlockArray arr = this.getArray(cy);
|
||||||
|
if(arr != null) {
|
||||||
|
arr.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.lightInit = true;
|
this.lightInit = true;
|
||||||
this.populated = true;
|
this.populated = true;
|
||||||
|
@ -996,11 +1109,14 @@ public class Chunk {
|
||||||
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
|
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
|
||||||
|
|
||||||
for(int n = 0; n < 8; ++n) {
|
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;
|
return;
|
||||||
|
|
||||||
int s = this.lightChecks % 31;
|
int s = (this.lightChecks % h) + this.bottom;
|
||||||
int x = this.lightChecks / 31 % 16;
|
int x = this.lightChecks / h % 16;
|
||||||
int z = this.lightChecks / 512;
|
int z = this.lightChecks / 512;
|
||||||
++this.lightChecks;
|
++this.lightChecks;
|
||||||
|
|
||||||
|
@ -1008,8 +1124,9 @@ public class Chunk {
|
||||||
BlockPos block = pos.add(x, (s << 4) + y, z);
|
BlockPos block = pos.add(x, (s << 4) + y, z);
|
||||||
boolean edge = y == 0 || y == 15 || x == 0 || x == 15 || z == 0 || z == 15;
|
boolean edge = y == 0 || y == 15 || x == 0 || x == 15 || z == 0 || z == 15;
|
||||||
|
|
||||||
if(this.blocks[s] == null && edge || this.blocks[s] != null
|
BlockArray arr = this.getArray(s);
|
||||||
&& this.blocks[s].getBlock(x, y, z).getMaterial() == Material.air) {
|
if(arr == null && edge || arr != null
|
||||||
|
&& arr.getBlock(x, y, z).getMaterial() == Material.air) {
|
||||||
for(Facing face : Facing.values()) {
|
for(Facing face : Facing.values()) {
|
||||||
BlockPos side = block.offset(face);
|
BlockPos side = block.offset(face);
|
||||||
|
|
||||||
|
@ -1092,11 +1209,12 @@ public class Chunk {
|
||||||
|
|
||||||
private boolean updateColumn(int x, int z) {
|
private boolean updateColumn(int x, int z) {
|
||||||
int top = this.getTopSegment();
|
int top = this.getTopSegment();
|
||||||
|
int bottom = this.getBottomSegment();
|
||||||
boolean opaque = false;
|
boolean opaque = false;
|
||||||
boolean below = false;
|
boolean below = false;
|
||||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos((this.xPos << 4) + x, 0, (this.zPos << 4) + z);
|
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());
|
pos.set(pos.getX(), y, pos.getZ());
|
||||||
int o = this.getOpacity(pos);
|
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());
|
pos.set(pos.getX(), y, pos.getZ());
|
||||||
|
|
||||||
if(this.getBlock(pos).getLightValue() > 0) {
|
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 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 = 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 long START_TIME = 4385238000L;
|
||||||
public static final float ABSOLUTE_ZERO = -273.15f;
|
public static final float ABSOLUTE_ZERO = -273.15f;
|
||||||
// private static final Calendar calendar = Calendar.getInstance();
|
// private static final Calendar calendar = Calendar.getInstance();
|
||||||
|
@ -109,7 +109,7 @@ public abstract class World implements IWorldAccess {
|
||||||
|
|
||||||
public static boolean isValid(BlockPos pos) {
|
public static boolean isValid(BlockPos pos) {
|
||||||
return pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE &&
|
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) {
|
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) {
|
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;
|
xStart = xStart >> 4;
|
||||||
zStart = zStart >> 4;
|
zStart = zStart >> 4;
|
||||||
xEnd = xEnd >> 4;
|
xEnd = xEnd >> 4;
|
||||||
|
@ -344,12 +344,12 @@ public abstract class World implements IWorldAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLight(BlockPos pos) {
|
public int getLight(BlockPos pos) {
|
||||||
if(pos.getY() < 0) {
|
if(pos.getY() < -MAX_SIZE_Y) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(pos.getY() >= 512) {
|
if(pos.getY() >= MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), 511, pos.getZ());
|
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getChunk(pos).getLightSub(pos, 0);
|
return this.getChunk(pos).getLightSub(pos, 0);
|
||||||
|
@ -387,12 +387,12 @@ public abstract class World implements IWorldAccess {
|
||||||
|
|
||||||
return i1;
|
return i1;
|
||||||
}
|
}
|
||||||
else if(pos.getY() < 0) {
|
else if(pos.getY() < -MAX_SIZE_Y) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(pos.getY() >= 512) {
|
if(pos.getY() >= MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), 511, pos.getZ());
|
pos = new BlockPos(pos.getX(), MAX_SIZE_Y - 1, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunk chunk = this.getChunk(pos);
|
Chunk chunk = this.getChunk(pos);
|
||||||
|
@ -442,8 +442,8 @@ public abstract class World implements IWorldAccess {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(pos.getY() < 0) {
|
if(pos.getY() < -MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), 0, pos.getZ());
|
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isValid(pos)) {
|
if(!isValid(pos)) {
|
||||||
|
@ -485,8 +485,8 @@ public abstract class World implements IWorldAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLightFor(LightType type, BlockPos pos) {
|
public int getLightFor(LightType type, BlockPos pos) {
|
||||||
if(pos.getY() < 0) {
|
if(pos.getY() < -MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), 0, pos.getZ());
|
pos = new BlockPos(pos.getX(), -MAX_SIZE_Y, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isValid(pos)) {
|
if(!isValid(pos)) {
|
||||||
|
@ -1593,7 +1593,7 @@ public abstract class World implements IWorldAccess {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
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();
|
Block block = this.getState(pos).getBlock();
|
||||||
|
|
||||||
if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer))
|
if((block.getMaterial() == Material.air || (allowLayers && block == Blocks.snow_layer))
|
||||||
|
|
|
@ -41,8 +41,6 @@ public class ClipboardPlacer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(BlockPos location, ClipboardBlock block) {
|
public void setBlock(BlockPos location, ClipboardBlock block) {
|
||||||
if(location.getY() < 0 || location.getY() > 511)
|
|
||||||
return;
|
|
||||||
Block type = block.getState().getBlock();
|
Block type = block.getState().getBlock();
|
||||||
if (ReorderRegistry.shouldPlaceLast(type)) {
|
if (ReorderRegistry.shouldPlaceLast(type)) {
|
||||||
// Place torches, etc. last
|
// 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("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));
|
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())
|
if (chunk.isPopulated())
|
||||||
{
|
{
|
||||||
list.add(chunk);
|
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();
|
iterator1.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -985,7 +985,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
||||||
{
|
{
|
||||||
if (list.size() == 1)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -2098,7 +2098,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
||||||
float f1 = this.entity.rotYaw;
|
float f1 = this.entity.rotYaw;
|
||||||
float f2 = this.entity.rotPitch;
|
float f2 = this.entity.rotPitch;
|
||||||
|
|
||||||
if (packetIn.isMoving() && packetIn.getPositionY() == -999.0D)
|
if (packetIn.isMoving() && packetIn.getPositionY() == -99999999.0D)
|
||||||
{
|
{
|
||||||
packetIn.setMoving(false);
|
packetIn.setMoving(false);
|
||||||
}
|
}
|
||||||
|
@ -2281,7 +2281,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (blockpos.getY() >= World.HEIGHT)
|
else if (blockpos.getY() >= World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2345,7 +2345,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer
|
||||||
this.tryUseItem(itemstack);
|
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;
|
double max = this.entity.getReachDistance() + 3.0D;
|
||||||
max *= max;
|
max *= max;
|
||||||
|
|
|
@ -376,12 +376,22 @@ public class Region {
|
||||||
chunk.setInhabited(tag.getLong("InhabitedTime"));
|
chunk.setInhabited(tag.getLong("InhabitedTime"));
|
||||||
NBTTagList sects = tag.getTagList("Sections", 10);
|
NBTTagList sects = tag.getTagList("Sections", 10);
|
||||||
int stor = 32;
|
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[] 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();
|
boolean light = !world.dimension.hasNoLight();
|
||||||
|
|
||||||
for(int n = 0; n < sects.tagCount(); ++n) {
|
for(int n = 0; n < sects.tagCount(); ++n) {
|
||||||
NBTTagCompound sect = sects.getCompoundTagAt(n);
|
NBTTagCompound sect = sects.getCompoundTagAt(n);
|
||||||
int y = sect.getByte("Y");
|
int y = sect.getInteger("Y");
|
||||||
BlockArray storage = new BlockArray(y << 4, light);
|
BlockArray storage = new BlockArray(y << 4, light);
|
||||||
byte[] blocks = sect.getByteArray("Blocks");
|
byte[] blocks = sect.getByteArray("Blocks");
|
||||||
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
||||||
|
@ -404,10 +414,15 @@ public class Region {
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.update();
|
storage.update();
|
||||||
sections[y] = storage;
|
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)) {
|
if(tag.hasKey("Biomes", 7)) {
|
||||||
chunk.setBiomes(tag.getByteArray("Biomes"));
|
chunk.setBiomes(tag.getByteArray("Biomes"));
|
||||||
|
@ -495,52 +510,58 @@ public class Region {
|
||||||
tag.setBoolean("LightPopulated", chunk.isLightPopulated());
|
tag.setBoolean("LightPopulated", chunk.isLightPopulated());
|
||||||
tag.setLong("InhabitedTime", chunk.getInhabited());
|
tag.setLong("InhabitedTime", chunk.getInhabited());
|
||||||
BlockArray[] sections = chunk.getStorage();
|
BlockArray[] sections = chunk.getStorage();
|
||||||
|
BlockArray[] down = chunk.getStorage();
|
||||||
|
BlockArray[] up = chunk.getStorage();
|
||||||
NBTTagList sects = new NBTTagList();
|
NBTTagList sects = new NBTTagList();
|
||||||
boolean light = !world.dimension.hasNoLight();
|
boolean light = !world.dimension.hasNoLight();
|
||||||
|
|
||||||
for(BlockArray storage : sections) {
|
for(BlockArray[] sec : new BlockArray[][] {sections, down, up}) {
|
||||||
if(storage != null) {
|
if(sec == null)
|
||||||
NBTTagCompound sect = new NBTTagCompound();
|
continue;
|
||||||
sect.setByte("Y", (byte)(storage.getY() >> 4 & 511));
|
for(BlockArray storage : sec) {
|
||||||
byte[] blocks = new byte[storage.getData().length];
|
if(storage != null) {
|
||||||
NibbleArray data = new NibbleArray();
|
NBTTagCompound sect = new NBTTagCompound();
|
||||||
NibbleArray adddata = null;
|
sect.setInteger("Y", storage.getY() >> 4);
|
||||||
|
byte[] blocks = new byte[storage.getData().length];
|
||||||
for(int c = 0; c < storage.getData().length; ++c) {
|
NibbleArray data = new NibbleArray();
|
||||||
char cd = storage.getData()[c];
|
NibbleArray adddata = null;
|
||||||
int cx = c & 15;
|
|
||||||
int cy = c >> 8 & 15;
|
for(int c = 0; c < storage.getData().length; ++c) {
|
||||||
int cz = c >> 4 & 15;
|
char cd = storage.getData()[c];
|
||||||
|
int cx = c & 15;
|
||||||
if(cd >> 12 != 0) {
|
int cy = c >> 8 & 15;
|
||||||
if(adddata == null) {
|
int cz = c >> 4 & 15;
|
||||||
adddata = new NibbleArray();
|
|
||||||
|
if(cd >> 12 != 0) {
|
||||||
|
if(adddata == null) {
|
||||||
|
adddata = new NibbleArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
adddata.set(cx, cy, cz, cd >> 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
adddata.set(cx, cy, cz, cd >> 12);
|
blocks[c] = (byte)(cd >> 4 & 255);
|
||||||
|
data.set(cx, cy, cz, cd & 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks[c] = (byte)(cd >> 4 & 255);
|
sect.setByteArray("Blocks", blocks);
|
||||||
data.set(cx, cy, cz, cd & 15);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,13 +90,10 @@ public abstract class Spawner {
|
||||||
Chunk chunk = world.getChunk(coord.x, coord.z);
|
Chunk chunk = world.getChunk(coord.x, coord.z);
|
||||||
int x = coord.x * 16 + world.rand.zrange(16);
|
int x = coord.x * 16 + world.rand.zrange(16);
|
||||||
int z = coord.z * 16 + world.rand.zrange(16);
|
int z = coord.z * 16 + world.rand.zrange(16);
|
||||||
int h = chunk.getHeight(new BlockPos(x, 0, z)) + 1;
|
int h = chunk.getTopSegment();
|
||||||
if(h > 0) {
|
if(h == Integer.MIN_VALUE)
|
||||||
int m = h % 16;
|
continue;
|
||||||
h = m == 0 ? h : h + 16 - m;
|
int y = world.rand.range(chunk.getBottomSegment(), h + 16);
|
||||||
}
|
|
||||||
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);
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
Block block = world.getState(pos).getBlock();
|
Block block = world.getState(pos).getBlock();
|
||||||
if(!block.isNormalCube()) {
|
if(!block.isNormalCube()) {
|
||||||
|
|
|
@ -741,7 +741,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
|
|
||||||
private BlockPos adjustPosToNearbyEntity(BlockPos pos) {
|
private BlockPos adjustPosToNearbyEntity(BlockPos pos) {
|
||||||
BlockPos blockpos = this.getPrecipitationHeight(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);
|
3.0D, 3.0D);
|
||||||
List<EntityLiving> list = this.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new Predicate<EntityLiving>() {
|
List<EntityLiving> list = this.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new Predicate<EntityLiving>() {
|
||||||
public boolean test(EntityLiving p_apply_1_) {
|
public boolean test(EntityLiving p_apply_1_) {
|
||||||
|
@ -2369,7 +2369,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
if(!this.canBurnAt(pos)) {
|
if(!this.canBurnAt(pos)) {
|
||||||
return false;
|
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();
|
Block block = this.getState(pos).getBlock();
|
||||||
|
|
||||||
if(block.getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(this, pos)) {
|
if(block.getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(this, pos)) {
|
||||||
|
@ -2385,7 +2385,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
State iblockstate = this.getState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
|
||||||
|
@ -2437,8 +2437,9 @@ public final class WorldServer extends AWorldServer {
|
||||||
Chunk chunk = this.getChunk(pos);
|
Chunk chunk = this.getChunk(pos);
|
||||||
BlockPos blockpos;
|
BlockPos blockpos;
|
||||||
BlockPos blockpos1;
|
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();
|
blockpos1 = blockpos.down();
|
||||||
Material material = chunk.getBlock(blockpos1).getMaterial();
|
Material material = chunk.getBlock(blockpos1).getMaterial();
|
||||||
|
|
||||||
|
@ -2802,8 +2803,10 @@ public final class WorldServer extends AWorldServer {
|
||||||
|
|
||||||
private class PlayerInstance {
|
private class PlayerInstance {
|
||||||
private final List<EntityNPC> watching = Lists.<EntityNPC>newArrayList();
|
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 final ChunkPos position;
|
||||||
private int[] changes = new int[64];
|
|
||||||
private int updates;
|
private int updates;
|
||||||
private int sections;
|
private int sections;
|
||||||
private long prevTime;
|
private long prevTime;
|
||||||
|
@ -2834,7 +2837,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
Chunk chunk = WorldServer.this.getChunk(this.position.x, this.position.z);
|
Chunk chunk = WorldServer.this.getChunk(this.position.x, this.position.z);
|
||||||
|
|
||||||
if(chunk.isPopulated()) {
|
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);
|
this.watching.remove(player);
|
||||||
|
@ -2877,10 +2880,13 @@ public final class WorldServer extends AWorldServer {
|
||||||
WorldServer.this.toUpdate.add(this);
|
WorldServer.this.toUpdate.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sections |= 1 << (y >> 4);
|
if(y >= 0 && y >> 4 < 32)
|
||||||
|
this.sections |= 1 << (y >> 4);
|
||||||
|
else
|
||||||
|
this.extend.add(y >> 4);
|
||||||
|
|
||||||
if(this.updates < 64) {
|
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) {
|
for(int i = 0; i < this.updates; ++i) {
|
||||||
if(this.changes[i] == pos) {
|
if(this.changes[i] == pos) {
|
||||||
|
@ -2905,9 +2911,9 @@ public final class WorldServer extends AWorldServer {
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
if(this.updates != 0) {
|
if(this.updates != 0) {
|
||||||
if(this.updates == 1) {
|
if(this.updates == 1) {
|
||||||
int x = (this.changes[0] >> 13 & 15) + this.position.x * 16;
|
int x = (int)(this.changes[0] >> 36 & 15L) + this.position.x * 16;
|
||||||
int y = this.changes[0] & 511;
|
int y = (int)(this.changes[0] & 4294967295L);
|
||||||
int z = (this.changes[0] >> 9 & 15) + this.position.z * 16;
|
int z = (int)(this.changes[0] >> 32 & 15L) + this.position.z * 16;
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos));
|
this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos));
|
||||||
|
|
||||||
|
@ -2918,11 +2924,36 @@ public final class WorldServer extends AWorldServer {
|
||||||
else if(this.updates == 64) {
|
else if(this.updates == 64) {
|
||||||
int x = this.position.x * 16;
|
int x = this.position.x * 16;
|
||||||
int z = this.position.z * 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.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 cy = 0; cy < 32; ++cy) {
|
for(int n = 0; n < list.size(); ++n) {
|
||||||
if((this.sections & 1 << cy) != 0) {
|
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;
|
int y = cy << 4;
|
||||||
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, y, z, x + 16, y + 16, z + 16);
|
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, y, z, x + 16, y + 16, z + 16);
|
||||||
|
|
||||||
|
@ -2937,9 +2968,9 @@ public final class WorldServer extends AWorldServer {
|
||||||
WorldServer.this.getChunk(this.position.x, this.position.z)));
|
WorldServer.this.getChunk(this.position.x, this.position.z)));
|
||||||
|
|
||||||
for(int n = 0; n < this.updates; ++n) {
|
for(int n = 0; n < this.updates; ++n) {
|
||||||
int x = (this.changes[n] >> 13 & 15) + this.position.x * 16;
|
int x = (int)(this.changes[n] >> 36 & 15L) + this.position.x * 16;
|
||||||
int y = this.changes[n] & 511;
|
int y = (int)(this.changes[n] & 4294967295L);
|
||||||
int z = (this.changes[n] >> 9 & 15) + this.position.z * 16;
|
int z = (int)(this.changes[n] >> 32 & 15L) + this.position.z * 16;
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
if(WorldServer.this.getState(pos).getBlock().hasTileEntity()) {
|
if(WorldServer.this.getState(pos).getBlock().hasTileEntity()) {
|
||||||
|
@ -2950,6 +2981,7 @@ public final class WorldServer extends AWorldServer {
|
||||||
|
|
||||||
this.updates = 0;
|
this.updates = 0;
|
||||||
this.sections = 0;
|
this.sections = 0;
|
||||||
|
this.extend.clear();
|
||||||
this.biomes = false;
|
this.biomes = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue