9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-25 09:59:15 +00:00

Fix build

This commit is contained in:
Dreeam
2025-03-25 03:29:15 -04:00
parent cbcc54726a
commit 2c7cb52e6b
13 changed files with 15 additions and 41 deletions

View File

@@ -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<RecipeMap> 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<?>> recipe, Consumer<RecipeDisplayEntry> output) {

View File

@@ -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<String> getList(String path, List<String> 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<String> 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);
}
}