diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionImpl.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionImpl.java index c24fcaaf6..402fc0913 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionImpl.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionImpl.java @@ -37,14 +37,14 @@ public class ChunkSectionImpl implements ChunkSection { public ChunkSectionImpl(final boolean holdsLight) { addPalette(PaletteType.BLOCKS, new DataPaletteImpl(ChunkSection.SIZE)); if (holdsLight) { - this.light = new ChunkSectionLightImpl(); + this.light = ChunkSectionLightImpl.createWithBlockLight(); } } public ChunkSectionImpl(final boolean holdsLight, final int expectedPaletteLength) { addPalette(PaletteType.BLOCKS, new DataPaletteImpl(ChunkSection.SIZE, expectedPaletteLength)); if (holdsLight) { - this.light = new ChunkSectionLightImpl(); + this.light = ChunkSectionLightImpl.createWithBlockLight(); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLight.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLight.java index 7badd3d5f..bb63a43c6 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLight.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLight.java @@ -35,7 +35,7 @@ public interface ChunkSectionLight { /** * Returns whether the section has sky light. * - * @return true if skylight is present + * @return true if sky light is present */ boolean hasSkyLight(); @@ -43,7 +43,7 @@ public interface ChunkSectionLight { * Returns whether the section has block light. * This returns true unless specifically set to null. * - * @return true if skylight is present + * @return true if block light is present */ boolean hasBlockLight(); diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLightImpl.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLightImpl.java index eb039d79f..61e49a76d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLightImpl.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/ChunkSectionLightImpl.java @@ -30,9 +30,17 @@ public class ChunkSectionLightImpl implements ChunkSectionLight { private NibbleArray blockLight; private NibbleArray skyLight; - public ChunkSectionLightImpl() { - // Block light is always written - this.blockLight = new NibbleArray(ChunkSection.SIZE); + protected ChunkSectionLightImpl() { + } + + public static ChunkSectionLight createWithBlockLight() { + final ChunkSectionLightImpl light = new ChunkSectionLightImpl(); + light.blockLight = new NibbleArray(ChunkSection.SIZE); + return light; + } + + public static ChunkSectionLight createEmpty() { + return new ChunkSectionLightImpl(); } @Override