From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Sun, 25 Dec 2022 23:39:05 +0100 Subject: [PATCH] Ignore null legacy structure data License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org This patch is based on the following patch: "Add null check in LegacyStructureDataHandler" By: PureGero As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java index e30a4b6578bf047bf860346c2da6b513c69bb1e5..aa0440b075f00255146b3b2f549e1a4eebb72dfe 100644 --- a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java +++ b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java @@ -172,13 +172,20 @@ public class LegacyStructureDataHandler { private void populateCaches(@Nullable DimensionDataStorage storage) { if (storage != null) { + boolean ignoreNullLegacyStructureData = org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.ignoreNullLegacyStructureData; // Gale - MultiPaper - ignore null legacy structure data for (String string : this.legacyKeys) { CompoundTag compoundTag = new CompoundTag(); try { - compoundTag = storage.readTagFromDisk(string, DataFixTypes.SAVED_DATA_STRUCTURE_FEATURE_INDICES, 1493) + // Gale start - MultiPaper - ignore null legacy structure data + CompoundTag tag = storage.readTagFromDisk(string, DataFixTypes.SAVED_DATA_STRUCTURE_FEATURE_INDICES, 1493); + + if (ignoreNullLegacyStructureData && tag == null) continue; + + compoundTag = tag .getCompoundOrEmpty("data") .getCompoundOrEmpty("Features"); + // Gale end - MultiPaper - ignore null legacy structure data if (compoundTag.isEmpty()) { continue; }