mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-21 15:59:28 +00:00
72 lines
4.0 KiB
Diff
72 lines
4.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
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 <puregero@gmail.com>
|
|
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/src/main/java/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java b/src/main/java/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java
|
|
index cc7222cc7e53e8ae693e4e94ad53391db7a663c4..9d1d7033fdd2ae65b8fd323e9199b9d5ea43fe35 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java
|
|
@@ -19,6 +19,7 @@ import net.minecraft.resources.ResourceKey;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.dimension.LevelStem;
|
|
import net.minecraft.world.level.storage.DimensionDataStorage;
|
|
+import org.galemc.gale.configuration.GaleGlobalConfiguration;
|
|
|
|
public class LegacyStructureDataHandler {
|
|
|
|
@@ -171,6 +172,7 @@ public class LegacyStructureDataHandler {
|
|
|
|
private void populateCaches(@Nullable DimensionDataStorage persistentStateManager) {
|
|
if (persistentStateManager != null) {
|
|
+ boolean ignoreNullLegacyStructureData = GaleGlobalConfiguration.get().misc.ignoreNullLegacyStructureData; // Gale - MultiPaper - ignore null legacy structure data
|
|
Iterator iterator = this.legacyKeys.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -178,7 +180,11 @@ public class LegacyStructureDataHandler {
|
|
CompoundTag nbttagcompound = new CompoundTag();
|
|
|
|
try {
|
|
- nbttagcompound = persistentStateManager.readTagFromDisk(s, 1493).getCompound("data").getCompound("Features");
|
|
+ // Gale start - MultiPaper - ignore null legacy structure data
|
|
+ CompoundTag tag = persistentStateManager.readTagFromDisk(s, 1493);
|
|
+ if (ignoreNullLegacyStructureData && tag == null) continue;
|
|
+ nbttagcompound = tag.getCompound("data").getCompound("Features");
|
|
+ // Gale end - MultiPaper - ignore null legacy structure data
|
|
if (nbttagcompound.isEmpty()) {
|
|
continue;
|
|
}
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
index 9576ce22e2c5fb06d10de00ca24fba9345087870..c2a6868d4dfb53d3fb5d1a0e51c016a01fc58acf 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
@@ -88,6 +88,19 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
|
|
public int premiumAccountSlowLoginTimeout = -1;
|
|
// Gale end - make slow login timeout configurable
|
|
|
|
+ // Gale start - MultiPaper - ignore null legacy structure data
|
|
+ /**
|
|
+ * Whether to ignore any legacy structure data, for which the NBT tag parser returns null for some reason.
|
|
+ * If true, no warning will be given when this happens.
|
|
+ * If false, an exception will be thrown in the console when this happens.
|
|
+ * <ul>
|
|
+ * <li><i>Default</i>: false</li>
|
|
+ * <li><i>Vanilla</i>: false</li>
|
|
+ * </ul>
|
|
+ */
|
|
+ public boolean ignoreNullLegacyStructureData = false;
|
|
+ // Gale end - MultiPaper - ignore null legacy structure data
|
|
+
|
|
public IncludeInTimingsReport includeInTimingsReport;
|
|
|
|
public class IncludeInTimingsReport extends ConfigurationPart {
|