From 364ada6346ab2a2b8fbfee601e2ca471fbc1162b Mon Sep 17 00:00:00 2001 From: Sen Date: Mon, 1 Sep 2025 16:28:19 +0200 Subject: [PATCH] fix broken height map updates --- common/src/main/java/common/world/Chunk.java | 30 +++++++++---------- common/src/main/java/common/world/World.java | 2 +- .../main/java/server/world/WorldServer.java | 6 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/common/src/main/java/common/world/Chunk.java b/common/src/main/java/common/world/Chunk.java index fdc96d48..dbbdf78f 100755 --- a/common/src/main/java/common/world/Chunk.java +++ b/common/src/main/java/common/world/Chunk.java @@ -155,7 +155,7 @@ public abstract class Chunk { return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15); } - public State setState(LocalPos pos, State state, boolean updateHeight) { + public State setState(LocalPos pos, State state) { int x = pos.getX() & 15; int y = pos.getY(); int z = pos.getZ() & 15; @@ -202,22 +202,20 @@ public abstract class Chunk { return null; } else { - if(updateHeight) { - if(up) { - this.genHeightMap(); + if(up) { + this.genHeightMap(); + } + else { + int b = block.getLightOpacity(); + int ob = oldb.getLightOpacity(); + + if(b > 0) { + if(y >= h) { + this.updateHeight(x, y + 1, z); + } } - else { - int b = block.getLightOpacity(); - int ob = oldb.getLightOpacity(); - - if(b > 0) { - if(y >= h) { - this.updateHeight(x, y + 1, z); - } - } - else if(y == h - 1) { - this.updateHeight(x, y, z); - } + else if(y == h - 1) { + this.updateHeight(x, y, z); } } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 66324931..1533937c 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -174,7 +174,7 @@ public abstract class World implements IWorldAccess { return false; Chunk chunk = this.getChunk(pos); Block block = newState.getBlock(); - State iblockstate = chunk.setState(pos, newState, true); + State iblockstate = chunk.setState(pos, newState); if(iblockstate == null) return false; Block block1 = iblockstate.getBlock(); diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index 81601d81..2eaac109 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -930,7 +930,7 @@ public final class WorldServer extends AWorldServer { if(block != Blocks.air && (block.getMaterial().isLiquid() || power - (block.getResistance() / 5.0F + 0.3F) * 0.3F > 0.0F)) { if(block.canExplosionDrop() && this.rand.floatv() <= 1.0F / (power * power)) block.drop(this, pos, state, 0); - this.setState(pos, Blocks.air.getState(), power < 40.0F ? 2 : 10); + this.setState(pos, Blocks.air.getState(), 2); block.onDestroyedExplosion(this, pos, source, state); return true; } @@ -2012,7 +2012,7 @@ public final class WorldServer extends AWorldServer { return false; ChunkServer chunk = this.getChunk(pos); Block block = newState.getBlock(); - State iblockstate = chunk.setState(pos, newState, (flags & 8) == 0); + State iblockstate = chunk.setState(pos, newState); if(iblockstate == null) return false; Block block1 = iblockstate.getBlock(); @@ -2037,7 +2037,7 @@ public final class WorldServer extends AWorldServer { } return true; } - State successState = chunk.setState(pos, newState, true); + State successState = chunk.setState(pos, newState); boolean successful = successState != null; if(successful) { if(block.getData() != null) {