From 733b118606664dd242d6fbdf0df01ca9c3439ee5 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 14 Jun 2021 13:52:25 +1000 Subject: [PATCH] SPIGOT-6554: Worlds created with the bukkit ChunkGenerator cannot save By: md_5 --- .../java/org/bukkit/craftbukkit/generator/CraftChunkData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java index a95a50958d..0a42a80a05 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -30,7 +30,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { /* pp for tests */ CraftChunkData(int minHeight, int maxHeight) { this.minHeight = minHeight; this.maxHeight = maxHeight; - sections = new ChunkSection[(maxHeight - minHeight) >> 4]; + sections = new ChunkSection[(((maxHeight - 1) >> 4) + 1) - (minHeight >> 4)]; } @Override @@ -162,7 +162,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { int offset = (y - minHeight) >> 4; ChunkSection section = sections[offset]; if (create && section == null) { - sections[offset] = section = new ChunkSection(offset << 4); + sections[offset] = section = new ChunkSection(offset + (minHeight >> 4)); } return section; }