From 1065ad346ee4885ad0dc566ccb601881cc312d39 Mon Sep 17 00:00:00 2001 From: Matt Worzala Date: Sun, 6 Jun 2021 19:33:21 -0400 Subject: [PATCH] get light section count from dimension type, add some missing getters to DimensionType --- .../java/net/minestom/server/instance/Chunk.java | 2 +- .../net/minestom/server/world/DimensionType.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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;