mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 01:17:47 +01:00
Fix lighting tests & heightmap (#137)
* fix tests * fix heightmap lookup (cherry picked from commit 7d717ada584bc3a3feaeda470113bb4adeb774ae)
This commit is contained in:
parent
a544b9f344
commit
f0f81803a5
@ -342,6 +342,8 @@ public class LightingChunk extends DynamicChunk {
|
|||||||
if (chunkCheck == null) continue;
|
if (chunkCheck == null) continue;
|
||||||
|
|
||||||
if (chunkCheck instanceof LightingChunk lighting) {
|
if (chunkCheck instanceof LightingChunk lighting) {
|
||||||
|
// Ensure heightmap is calculated before taking values from it
|
||||||
|
lighting.getHeightmap();
|
||||||
if (lighting.highestBlock > highestRegionPoint) highestRegionPoint = lighting.highestBlock;
|
if (lighting.highestBlock > highestRegionPoint) highestRegionPoint = lighting.highestBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class BlockLightMergeIntegrationTest {
|
|||||||
expectedLights.put(new Vec(-2, 100 + y, 8), 0);
|
expectedLights.put(new Vec(-2, 100 + y, 8), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LightingChunk.relightSection(instance, 0, 2, 0);
|
LightingChunk.relightSection(instance, 0, 6, 0);
|
||||||
|
|
||||||
assertLightInstance(instance, expectedLights);
|
assertLightInstance(instance, expectedLights);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ public class WorldRelightIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBorderLava(Env env) {
|
public void testBorderLava(Env env) {
|
||||||
Instance instance = env.createFlatInstance();
|
Instance instance = env.createFlatInstance();
|
||||||
|
instance.setChunkSupplier(LightingChunk::new);
|
||||||
instance.loadChunk(6, 16).join();
|
instance.loadChunk(6, 16).join();
|
||||||
instance.loadChunk(6, 15).join();
|
instance.loadChunk(6, 15).join();
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ public class WorldRelightIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBlockRemoval(Env env) {
|
public void testBlockRemoval(Env env) {
|
||||||
Instance instance = createLightingInstance(env.process());
|
Instance instance = createLightingInstance(env.process());
|
||||||
|
instance.setChunkSupplier(LightingChunk::new);
|
||||||
for (int x = -3; x <= 3; x++) {
|
for (int x = -3; x <= 3; x++) {
|
||||||
for (int z = -3; z <= 3; z++) {
|
for (int z = -3; z <= 3; z++) {
|
||||||
instance.loadChunk(x, z).join();
|
instance.loadChunk(x, z).join();
|
||||||
|
Loading…
Reference in New Issue
Block a user