From 906f16d07570baf47ea6305d3977494233e51082 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 10 Sep 2018 06:38:22 +1000 Subject: [PATCH] Fixes #2092 --- .../plotsquared/sponge/util/block/SpongeLocalQueue.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java index b74b9f8d8..ed1c664dd 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java @@ -434,6 +434,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue { public void setBlocks(LocalChunk lc) { World worldObj = getSpongeWorld(); + net.minecraft.world.World nmsWorld = ((net.minecraft.world.World) worldObj); org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ()); Chunk nmsChunk = (Chunk) spongeChunk; char[][] ids = ((CharLocalChunk) lc).blocks; @@ -442,7 +443,12 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue { if (array == null) { continue; } - ExtendedBlockStorage section = nmsChunk.getBlockStorageArray()[layer]; + ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray(); + ExtendedBlockStorage section = sections[layer]; + if (section == null) { + section = sections[layer] = new ExtendedBlockStorage(layer << 4, nmsWorld.provider.hasSkyLight()); + } + short[] cacheX = MainUtil.x_loc[0]; short[] cacheY = MainUtil.y_loc[0]; short[] cacheZ = MainUtil.z_loc[0];