Fix lighting tests & heightmap (#137)

* fix tests

* fix heightmap lookup

(cherry picked from commit 7d717ada584bc3a3feaeda470113bb4adeb774ae)
This commit is contained in:
iam 2024-02-07 00:40:02 -05:00 committed by Matt Worzala
parent a544b9f344
commit f0f81803a5
3 changed files with 5 additions and 1 deletions

View File

@ -342,6 +342,8 @@ public class LightingChunk extends DynamicChunk {
if (chunkCheck == null) continue;
if (chunkCheck instanceof LightingChunk lighting) {
// Ensure heightmap is calculated before taking values from it
lighting.getHeightmap();
if (lighting.highestBlock > highestRegionPoint) highestRegionPoint = lighting.highestBlock;
}
}

View File

@ -139,7 +139,7 @@ public class BlockLightMergeIntegrationTest {
expectedLights.put(new Vec(-2, 100 + y, 8), 0);
}
LightingChunk.relightSection(instance, 0, 2, 0);
LightingChunk.relightSection(instance, 0, 6, 0);
assertLightInstance(instance, expectedLights);
}

View File

@ -30,6 +30,7 @@ public class WorldRelightIntegrationTest {
@Test
public void testBorderLava(Env env) {
Instance instance = env.createFlatInstance();
instance.setChunkSupplier(LightingChunk::new);
instance.loadChunk(6, 16).join();
instance.loadChunk(6, 15).join();
@ -47,6 +48,7 @@ public class WorldRelightIntegrationTest {
@Test
public void testBlockRemoval(Env env) {
Instance instance = createLightingInstance(env.process());
instance.setChunkSupplier(LightingChunk::new);
for (int x = -3; x <= 3; x++) {
for (int z = -3; z <= 3; z++) {
instance.loadChunk(x, z).join();