make world taller

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

View file

@ -767,8 +767,8 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
// this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.getExtractedExtend(), packetIn.hasBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
{
@ -781,7 +781,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setBiomes(packetIn.getBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
}
/**
@ -1413,8 +1413,8 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
this.clientWorldController.doPreChunk(j, k, true);
// this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
Chunk chunk = this.clientWorldController.getChunk(j, k);
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true);
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 512, (k << 4) + 15);
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), packetIn.getChunkExtend(i), true);
this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, -World.MAX_SIZE_Y, k << 4, (j << 4) + 15, World.MAX_SIZE_Y, (k << 4) + 15);
if (this.clientWorldController.dimension.hasNoLight()) // TODO: check
{

View file

@ -87,7 +87,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
private State getBlockStateRaw(BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
@ -136,7 +136,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
{
return 0;
}
else if (pos.getY() >= 0 && pos.getY() < 512)
else if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
if (this.getState(pos).getBlock().getSumBrightness())
{
@ -183,7 +183,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
public int getLightFor(LightType p_175628_1_, BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 512)
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;

View file

@ -53,6 +53,7 @@ import common.util.Vec3;
import common.util.Vector3f;
import common.world.Chunk;
import common.world.State;
import common.world.World;
public class RenderGlobal
{
@ -632,7 +633,7 @@ public class RenderGlobal
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
if (entity2.posY < 0.0D || entity2.posY >= 512.0D || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
{
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 /* || flag3 */)) {
++this.countEntitiesRendered;
@ -931,7 +932,7 @@ public class RenderGlobal
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
{
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 512 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= -World.MAX_SIZE_Y && blockpos.getY() < World.MAX_SIZE_Y ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
}
protected Vector3f getViewVector(Entity entityIn, double partialTicks)

View file

@ -19,14 +19,12 @@ public class EmptyChunk extends Chunk {
private final int liquidY;
private final State liquid;
private final Block liquidBlock;
private final int liquidMeta;
public EmptyChunk(WorldClient world) {
super(world, 0, 0);
this.liquidY = world.dimension.getSeaLevel() - 1;
this.liquid = world.dimension.getLiquid();
this.liquidBlock = this.liquid.getBlock();
this.liquidMeta = this.liquidBlock.getMetaFromState(this.liquid);
}
public int getHeight(int x, int z) {
@ -107,7 +105,7 @@ public class EmptyChunk extends Chunk {
return true;
}
public void setData(byte[] data, int update, boolean biomes) {
public void setData(byte[] data, int update, int[] extend, boolean biomes) {
}
public Biome getBiome(BlockPos pos, BiomeGenerator gen) {

View file

@ -36,6 +36,7 @@ import common.util.BlockPos.MutableBlockPos;
import common.world.Chunk;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
public class WorldClient extends AWorldClient
{
@ -80,14 +81,14 @@ public class WorldClient extends AWorldClient
this.chunkMapping.add(id, this.emptyChunk);
this.emptyChunkListing.remove(id);
this.nextEmptyChunkListing.add(id);
this.markBlockRangeForRenderUpdate(x << 4, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
}
}
for(Long id : this.emptyChunkListing) {
this.chunkMapping.remove(id);
int x = LongHashMap.getX(id);
int z = LongHashMap.getZ(id);
this.markBlockRangeForRenderUpdate(x << 4, 0, z << 4, (x << 4) + 15, 512, (z << 4) + 15);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
}
this.emptyChunkListing.clear();
this.emptyChunkListing.addAll(this.nextEmptyChunkListing);
@ -184,7 +185,7 @@ public class WorldClient extends AWorldClient
if (!load)
{
this.markBlockRangeForRenderUpdate(x * 16, 0, z * 16, x * 16 + 15, 512, z * 16 + 15);
this.markBlockRangeForRenderUpdate(x * 16, -World.MAX_SIZE_Y, z * 16, x * 16 + 15, World.MAX_SIZE_Y, z * 16 + 15);
}
}