From 2c7cb52e6be0fb8e08c13201197992e40e5983ab Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Tue, 25 Mar 2025 03:29:15 -0400 Subject: [PATCH] Fix build --- ...r-PR-Throttle-failed-spawn-attempts.patch} | 0 ...e-display-index-before-retrieving-it.patch | 23 ------------- ...BlockEntity-ticking-isRemoved-check.patch} | 0 ...7-Raytrace-AntiXray-SDK-integration.patch} | 0 ...timize-addOrUpdateTransientModifier.patch} | 0 ... => 0149-Optimize-ContextMap.create.patch} | 0 ...Micro-optimizations-for-random-tick.patch} | 0 ...n-updateConnectedPlayersWithinRange.patch} | 0 ...52-Remove-streams-on-PlayerDetector.patch} | 0 ...ing.patch => 0153-AsyncBlockFinding.patch} | 0 ...54-Direct-iteration-on-Sensing.tick.patch} | 0 ...ng.patch => 0155-AsyncPacketSending.patch} | 0 .../dreeam/leaf/config/LeafGlobalConfig.java | 33 +++++++++---------- 13 files changed, 15 insertions(+), 41 deletions(-) rename leaf-server/minecraft-patches/features/{0146-Paper-PR-Throttle-failed-spawn-attempts.patch => 0145-Paper-PR-Throttle-failed-spawn-attempts.patch} (100%) delete mode 100644 leaf-server/minecraft-patches/features/0145-Validate-recipe-display-index-before-retrieving-it.patch rename leaf-server/minecraft-patches/features/{0147-Improve-BlockEntity-ticking-isRemoved-check.patch => 0146-Improve-BlockEntity-ticking-isRemoved-check.patch} (100%) rename leaf-server/minecraft-patches/features/{0148-Raytrace-AntiXray-SDK-integration.patch => 0147-Raytrace-AntiXray-SDK-integration.patch} (100%) rename leaf-server/minecraft-patches/features/{0149-Optimize-addOrUpdateTransientModifier.patch => 0148-Optimize-addOrUpdateTransientModifier.patch} (100%) rename leaf-server/minecraft-patches/features/{0150-Optimize-ContextMap.create.patch => 0149-Optimize-ContextMap.create.patch} (100%) rename leaf-server/minecraft-patches/features/{0151-Micro-optimizations-for-random-tick.patch => 0150-Micro-optimizations-for-random-tick.patch} (100%) rename leaf-server/minecraft-patches/features/{0152-Remove-streams-on-updateConnectedPlayersWithinRange.patch => 0151-Remove-streams-on-updateConnectedPlayersWithinRange.patch} (100%) rename leaf-server/minecraft-patches/features/{0153-Remove-streams-on-PlayerDetector.patch => 0152-Remove-streams-on-PlayerDetector.patch} (100%) rename leaf-server/minecraft-patches/features/{0154-AsyncBlockFinding.patch => 0153-AsyncBlockFinding.patch} (100%) rename leaf-server/minecraft-patches/features/{0155-Direct-iteration-on-Sensing.tick.patch => 0154-Direct-iteration-on-Sensing.tick.patch} (100%) rename leaf-server/minecraft-patches/features/{0156-AsyncPacketSending.patch => 0155-AsyncPacketSending.patch} (100%) diff --git a/leaf-server/minecraft-patches/features/0146-Paper-PR-Throttle-failed-spawn-attempts.patch b/leaf-server/minecraft-patches/features/0145-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0146-Paper-PR-Throttle-failed-spawn-attempts.patch rename to leaf-server/minecraft-patches/features/0145-Paper-PR-Throttle-failed-spawn-attempts.patch diff --git a/leaf-server/minecraft-patches/features/0145-Validate-recipe-display-index-before-retrieving-it.patch b/leaf-server/minecraft-patches/features/0145-Validate-recipe-display-index-before-retrieving-it.patch deleted file mode 100644 index 97bc0eee..00000000 --- a/leaf-server/minecraft-patches/features/0145-Validate-recipe-display-index-before-retrieving-it.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> -Date: Wed, 19 Mar 2025 13:32:39 -0400 -Subject: [PATCH] Validate recipe display index before retrieving it - - -diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index 4bd1b514f91c0a2c9261b41211a4a341f784a995..5b69c4927174611d62f0f4698215ab97c827c7f5 100644 ---- a/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -206,7 +206,11 @@ public class RecipeManager extends SimplePreparableReloadListener imp - - @Nullable - public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) { -- return this.allDisplays.get(display.index()); -+ // Leaf start - Validate recipe display index before retrieving it -+ final int index = display.index(); -+ -+ return this.allDisplays.size() > index ? this.allDisplays.get(index) : null; -+ // Leaf end - Validate recipe display index before retrieving it - } - - public void listDisplaysForRecipe(ResourceKey> recipe, Consumer output) { diff --git a/leaf-server/minecraft-patches/features/0147-Improve-BlockEntity-ticking-isRemoved-check.patch b/leaf-server/minecraft-patches/features/0146-Improve-BlockEntity-ticking-isRemoved-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0147-Improve-BlockEntity-ticking-isRemoved-check.patch rename to leaf-server/minecraft-patches/features/0146-Improve-BlockEntity-ticking-isRemoved-check.patch diff --git a/leaf-server/minecraft-patches/features/0148-Raytrace-AntiXray-SDK-integration.patch b/leaf-server/minecraft-patches/features/0147-Raytrace-AntiXray-SDK-integration.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0148-Raytrace-AntiXray-SDK-integration.patch rename to leaf-server/minecraft-patches/features/0147-Raytrace-AntiXray-SDK-integration.patch diff --git a/leaf-server/minecraft-patches/features/0149-Optimize-addOrUpdateTransientModifier.patch b/leaf-server/minecraft-patches/features/0148-Optimize-addOrUpdateTransientModifier.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0149-Optimize-addOrUpdateTransientModifier.patch rename to leaf-server/minecraft-patches/features/0148-Optimize-addOrUpdateTransientModifier.patch diff --git a/leaf-server/minecraft-patches/features/0150-Optimize-ContextMap.create.patch b/leaf-server/minecraft-patches/features/0149-Optimize-ContextMap.create.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0150-Optimize-ContextMap.create.patch rename to leaf-server/minecraft-patches/features/0149-Optimize-ContextMap.create.patch diff --git a/leaf-server/minecraft-patches/features/0151-Micro-optimizations-for-random-tick.patch b/leaf-server/minecraft-patches/features/0150-Micro-optimizations-for-random-tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0151-Micro-optimizations-for-random-tick.patch rename to leaf-server/minecraft-patches/features/0150-Micro-optimizations-for-random-tick.patch diff --git a/leaf-server/minecraft-patches/features/0152-Remove-streams-on-updateConnectedPlayersWithinRange.patch b/leaf-server/minecraft-patches/features/0151-Remove-streams-on-updateConnectedPlayersWithinRange.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0152-Remove-streams-on-updateConnectedPlayersWithinRange.patch rename to leaf-server/minecraft-patches/features/0151-Remove-streams-on-updateConnectedPlayersWithinRange.patch diff --git a/leaf-server/minecraft-patches/features/0153-Remove-streams-on-PlayerDetector.patch b/leaf-server/minecraft-patches/features/0152-Remove-streams-on-PlayerDetector.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0153-Remove-streams-on-PlayerDetector.patch rename to leaf-server/minecraft-patches/features/0152-Remove-streams-on-PlayerDetector.patch diff --git a/leaf-server/minecraft-patches/features/0154-AsyncBlockFinding.patch b/leaf-server/minecraft-patches/features/0153-AsyncBlockFinding.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0154-AsyncBlockFinding.patch rename to leaf-server/minecraft-patches/features/0153-AsyncBlockFinding.patch diff --git a/leaf-server/minecraft-patches/features/0155-Direct-iteration-on-Sensing.tick.patch b/leaf-server/minecraft-patches/features/0154-Direct-iteration-on-Sensing.tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0155-Direct-iteration-on-Sensing.tick.patch rename to leaf-server/minecraft-patches/features/0154-Direct-iteration-on-Sensing.tick.patch diff --git a/leaf-server/minecraft-patches/features/0156-AsyncPacketSending.patch b/leaf-server/minecraft-patches/features/0155-AsyncPacketSending.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0156-AsyncPacketSending.patch rename to leaf-server/minecraft-patches/features/0155-AsyncPacketSending.patch diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java index 263b0d63..3d4a6257 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java @@ -94,6 +94,16 @@ public class LeafGlobalConfig { return configFile.getInteger(path, def); } + public long getLong(String path, long def, String comment) { + configFile.addDefault(path, def, comment); + return configFile.getLong(path, def); + } + + public long getLong(String path, long def) { + configFile.addDefault(path, def); + return configFile.getLong(path, def); + } + public List getList(String path, List def, String comment) { configFile.addDefault(path, def, comment); return configFile.getStringList(path); @@ -122,7 +132,6 @@ public class LeafGlobalConfig { public Boolean getBoolean(String path) { String value = configFile.getString(path, null); - return value == null ? null : Boolean.parseBoolean(value); } @@ -132,16 +141,19 @@ public class LeafGlobalConfig { public Double getDouble(String path) { String value = configFile.getString(path, null); - return value == null ? null : Double.parseDouble(value); // TODO: Need to check whether need to handle NFE correctly } public Integer getInt(String path) { String value = configFile.getString(path, null); - return value == null ? null : Integer.parseInt(value); // TODO: Need to check whether need to handle NFE correctly } + public Long getLong(String path) { + String value = configFile.getString(path, null); + return value == null ? null : Long.parseLong(value); // TODO: Need to check whether need to handle NFE correctly + } + public List getList(String path) { return configFile.getList(path, null); } @@ -177,19 +189,4 @@ public class LeafGlobalConfig { public String pickStringRegionBased(String en, String cn) { return isCN ? cn : en; } - - public long getLong(String path, long def, String comment) { - configFile.addDefault(path, def, comment); - return configFile.getLong(path, def); - } - - public long getLong(String path, long def) { - configFile.addDefault(path, def); - return configFile.getLong(path, def); - } - public Long getLong(String path) { - String value = configFile.getString(path, null); - return value == null ? null : Long.parseLong(value); - } - }