diff --git a/src/main/java/net/minestom/server/instance/Chunk.java b/src/main/java/net/minestom/server/instance/Chunk.java index 8b0777da1..127842b3c 100644 --- a/src/main/java/net/minestom/server/instance/Chunk.java +++ b/src/main/java/net/minestom/server/instance/Chunk.java @@ -391,7 +391,7 @@ public abstract class Chunk implements Viewable, Tickable, DataContainer { updateLightPacket.chunkX = getChunkX(); updateLightPacket.chunkZ = getChunkZ(); - final int sectionCount = 16 + 2; //todo + final int sectionCount = (getInstance().getDimensionType().getTotalHeight() / 16) + 2; final int maskLength = (int) Math.ceil((double) sectionCount / 64); updateLightPacket.skyLightMask = new long[maskLength]; diff --git a/src/main/java/net/minestom/server/world/DimensionType.java b/src/main/java/net/minestom/server/world/DimensionType.java index 56e917ec3..91e738f4c 100644 --- a/src/main/java/net/minestom/server/world/DimensionType.java +++ b/src/main/java/net/minestom/server/world/DimensionType.java @@ -199,6 +199,14 @@ public class DimensionType { return this.piglinSafe; } + public int getMinY() { + return minY; + } + + public int getHeight() { + return height; + } + public int getLogicalHeight() { return this.logicalHeight; } @@ -211,6 +219,10 @@ public class DimensionType { return this.infiniburn; } + public int getTotalHeight() { + return minY + height; + } + @Override public boolean equals(Object o) { if (this == o) return true;