mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 10:29:13 +00:00
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2 since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList. Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2 lazy handles filter condition on iteration, so much better.
41 lines
2.2 KiB
Diff
41 lines
2.2 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/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;
|
|
}
|