From c93aff73119e95bb2ac2935c9bd07bfc18f83a61 Mon Sep 17 00:00:00 2001 From: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Sun, 10 Nov 2024 01:50:12 +0100 Subject: [PATCH] Fix stackoverflow & update GroovyScript (#2657) --- dependencies.gradle | 2 +- src/main/java/gregtech/GregTechMod.java | 2 +- .../gregtech/integration/groovy/GrSRecipeHelper.java | 10 +++++----- .../gregtech/integration/groovy/GroovyExpansions.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index ce3f8136297..9ccd17cb2c0 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -41,7 +41,7 @@ dependencies { // Published dependencies api("codechicken:codechickenlib:3.2.3.358") api("com.cleanroommc:modularui:2.5.0-rc1") { transitive = false } - api("com.cleanroommc:groovyscript:1.1.1") { transitive = false } + api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false } api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700") api("appeng:ae2-uel:v0.56.4") { transitive = false } api rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31 diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index 59a72f3db03..04fcd09786c 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -33,7 +33,7 @@ dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + "required-after:modularui@[2.3,);" + "required-after:mixinbooter@[8.0,);" + "after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" + "after:genetics;" + "after:magicbees;" + - "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[1.1.0,);" + + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[1.2.0,);" + "after:theoneprobe;" + "after:hwyla;") public class GregTechMod { diff --git a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java index 9c686f88946..f2f8c4cb67e 100644 --- a/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java +++ b/src/main/java/gregtech/integration/groovy/GrSRecipeHelper.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.GroovyScriptCodeConverter; import com.cleanroommc.groovyscript.helper.ingredient.NbtHelper; public class GrSRecipeHelper { @@ -20,7 +20,7 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) .append(recipe.getEUt()) .append(", "); - if (recipe.getInputs().size() > 0) { + if (!recipe.getInputs().isEmpty()) { builder.append("["); for (GTRecipeInput ci : recipe.getInputs()) { String ingredient = getGroovyItemString(ci); @@ -32,10 +32,10 @@ public static String getRecipeRemoveLine(RecipeMap recipeMap, Recipe recipe) builder.append("null, "); } - if (recipe.getFluidInputs().size() > 0) { + if (!recipe.getFluidInputs().isEmpty()) { builder.append("["); for (GTRecipeInput fluidIngredient : recipe.getFluidInputs()) { - builder.append(IngredientHelper.asGroovyCode(fluidIngredient.getInputFluidStack(), false)); + builder.append(GroovyScriptCodeConverter.asGroovyCode(fluidIngredient.getInputFluidStack(), false)); if (fluidIngredient.getAmount() > 1) { builder.append(" * ") @@ -72,7 +72,7 @@ public static String getGroovyItemString(GTRecipeInput recipeInput) { } if (itemStack != null) { if (itemId == null) { - builder.append(IngredientHelper.asGroovyCode(itemStack, false)); + builder.append(GroovyScriptCodeConverter.asGroovyCode(itemStack, false)); } if (itemStack.getTagCompound() != null) { diff --git a/src/main/java/gregtech/integration/groovy/GroovyExpansions.java b/src/main/java/gregtech/integration/groovy/GroovyExpansions.java index 00a7906fb0e..bd7e01ca643 100644 --- a/src/main/java/gregtech/integration/groovy/GroovyExpansions.java +++ b/src/main/java/gregtech/integration/groovy/GroovyExpansions.java @@ -29,7 +29,7 @@ public static Material.Builder materialBuilder(MaterialEvent event, int id, Reso } public static Material.Builder materialBuilder(MaterialEvent event, int id, String domain, String path) { - return materialBuilder(event, id, domain, path); + return materialBuilder(event, id, new ResourceLocation(domain, path)); } public static Material.Builder materialBuilder(MaterialEvent event, int id, String s) {