diff --git a/patches/server/Allow-Saving-of-Oversized-Chunks.patch b/patches/server/Allow-Saving-of-Oversized-Chunks.patch index ef204e5888..dd376ec64d 100644 --- a/patches/server/Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/Allow-Saving-of-Oversized-Chunks.patch @@ -190,12 +190,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return chunk; + } + CompoundTag oversizedLevel = oversizedData.getCompound("Level"); -+ CompoundTag level = chunk.getCompound("Level"); + -+ mergeChunkList(level, oversizedLevel, "Entities"); -+ mergeChunkList(level, oversizedLevel, "TileEntities"); -+ -+ chunk.put("Level", level); ++ mergeChunkList(chunk, oversizedLevel, "entities", "Entities"); ++ mergeChunkList(chunk, oversizedLevel, "block_entities", "TileEntities"); + + return chunk; + } catch (Throwable throwable) { @@ -205,9 +202,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private static void mergeChunkList(CompoundTag level, CompoundTag oversizedLevel, String key) { ++ private static void mergeChunkList(CompoundTag level, CompoundTag oversizedLevel, String key, String oversizedKey) { + ListTag levelList = level.getList(key, 10); -+ ListTag oversizedList = oversizedLevel.getList(key, 10); ++ ListTag oversizedList = oversizedLevel.getList(oversizedKey, 10); + + if (!oversizedList.isEmpty()) { + levelList.addAll(oversizedList); diff --git a/patches/server/Rewrite-the-light-engine.patch b/patches/server/Rewrite-the-light-engine.patch index 07ffe96bc8..7edc3a3a93 100644 --- a/patches/server/Rewrite-the-light-engine.patch +++ b/patches/server/Rewrite-the-light-engine.patch @@ -4128,8 +4128,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private static void saveLightHookReal(final Level world, final ChunkAccess chunk, final CompoundTag nbt) { -+ if (nbt == null) { ++ private static void saveLightHookReal(final Level world, final ChunkAccess chunk, final CompoundTag tag) { ++ if (tag == null) { + return; + } + @@ -4139,18 +4139,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + SWMRNibbleArray[] blockNibbles = chunk.getBlockNibbles(); + SWMRNibbleArray[] skyNibbles = chunk.getSkyNibbles(); + -+ CompoundTag level = nbt.getCompound("Level"); + boolean lit = chunk.isLightCorrect() || !(world instanceof ServerLevel); + // diff start - store our tag for whether light data is init'd + if (lit) { -+ level.putBoolean("isLightOn", false); ++ tag.putBoolean("isLightOn", false); + } + // diff end - store our tag for whether light data is init'd -+ ChunkStatus status = ChunkStatus.byName(level.getString("Status")); ++ ChunkStatus status = ChunkStatus.byName(tag.getString("Status")); + + CompoundTag[] sections = new CompoundTag[maxSection - minSection + 1]; + -+ ListTag sectionsStored = level.getList("Sections", 10); ++ ListTag sectionsStored = tag.getList("sections", 10); + + for (int i = 0; i < sectionsStored.size(); ++i) { + CompoundTag sectionStored = sectionsStored.getCompound(i); @@ -4207,9 +4206,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + sectionsStored.add(section); + } + } -+ level.put("Sections", sectionsStored); ++ tag.put("sections", sectionsStored); + if (lit) { -+ level.putInt(STARLIGHT_VERSION_TAG, STARLIGHT_LIGHT_VERSION); // only mark as fully lit after we have successfully injected our data ++ tag.putInt(STARLIGHT_VERSION_TAG, STARLIGHT_LIGHT_VERSION); // only mark as fully lit after we have successfully injected our data + } + } + @@ -4237,12 +4236,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + + // start copy from from the original method -+ CompoundTag levelTag = tag.getCompound("Level"); -+ boolean lit = levelTag.get("isLightOn") != null && levelTag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; ++ boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; + boolean canReadSky = world.dimensionType().hasSkyLight(); -+ ChunkStatus status = ChunkStatus.byName(tag.getCompound("Level").getString("Status")); ++ ChunkStatus status = ChunkStatus.byName(tag.getString("Status")); + if (lit && status.isOrAfter(ChunkStatus.LIGHT)) { // diff - we add the status check here -+ ListTag sections = levelTag.getList("Sections", 10); ++ ListTag sections = tag.getList("sections", 10); + + for (int i = 0; i < sections.size(); ++i) { + CompoundTag sectionData = sections.getCompound(i);