From e51ec608d9edbabb0f58944158204b766985af92 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Wed, 14 Dec 2022 00:00:24 +0100 Subject: [PATCH] Fix (#26) * Remove GitHub action and some code in build.gradle, add Botania support. cherry pick facd8b6c4ef3046de9bdfee919b67242098f0c05 * cherry pick 21f3a2d8fc5dfd1bbbb9a45dabfd1981b1790189 * Update BS+SA * add botania as dep * spotlessApply Co-authored-by: vfyjxf <2331007009@qq.com> Co-authored-by: vfyjxf <42764413+vfyjxf@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions <> Co-authored-by: glowredman <35727266+glowredman@users.noreply.github.com> --- dependencies.gradle | 1 + .../github/vfyjxf/nee/config/NEEConfig.java | 2 +- .../nee/processor/BotaniaRecipeProcessor.java | 50 +++++++++++++++++++ .../vfyjxf/nee/processor/RecipeProcessor.java | 5 ++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/vfyjxf/nee/processor/BotaniaRecipeProcessor.java diff --git a/dependencies.gradle b/dependencies.gradle index bf4352d..9f6ba75 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -14,6 +14,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.41.37:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.90:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.3.19-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Botania:1.9.11-GTNH:dev") { transitive = false } compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false } compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false } compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false } diff --git a/src/main/java/com/github/vfyjxf/nee/config/NEEConfig.java b/src/main/java/com/github/vfyjxf/nee/config/NEEConfig.java index 9498c25..215548f 100644 --- a/src/main/java/com/github/vfyjxf/nee/config/NEEConfig.java +++ b/src/main/java/com/github/vfyjxf/nee/config/NEEConfig.java @@ -274,7 +274,7 @@ public static void setTransformBlacklist(String[] transformBlacklist) { public static void setTransformPriorityList(String[] transformPriorityList) { NEEConfig.transformPriorityList = transformPriorityList; - config.get("client", "transformPriorityModList", new String[0], "if oredict has this mod's item, use it first") + config.get("client", "transformItemPriorityList", new String[0], "if oredict has this mod's item, use it first") .set(transformPriorityList); config.save(); } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/BotaniaRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/BotaniaRecipeProcessor.java new file mode 100644 index 0000000..737306a --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/processor/BotaniaRecipeProcessor.java @@ -0,0 +1,50 @@ +package com.github.vfyjxf.nee.processor; + +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.IRecipeHandler; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.annotation.Nonnull; +import vazkii.botania.client.integration.nei.recipe.RecipeHandlerLexicaBotania; + +public class BotaniaRecipeProcessor implements IRecipeProcessor { + @Nonnull + @Override + public Set getAllOverlayIdentifier() { + return Collections.singleton(RecipeProcessor.NULL_IDENTIFIER); + } + + @Nonnull + @Override + public String getRecipeProcessorId() { + return " Botania"; + } + + @Nonnull + @Override + public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { + List recipeInputs = new ArrayList<>(); + if (recipe instanceof RecipeHandlerLexicaBotania) { + // we don't need to get recipe from a book. + // but botania doesn't provide an identifier for each recipe handler, so the button will still show. + return recipeInputs; + } + recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex)); + return recipeInputs; + } + + @Nonnull + @Override + public List getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) { + List recipeOutputs = new ArrayList<>(); + if (recipe instanceof RecipeHandlerLexicaBotania) { + // we don't need to get recipe from a book. + // but botania doesn't provide an identifier for each recipe handler, so the button will still show. + return recipeOutputs; + } + recipeOutputs.add(recipe.getResultStack(recipeIndex)); + return recipeOutputs; + } +} diff --git a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java index 1886e82..341de43 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java @@ -20,6 +20,11 @@ public static void init() { recipeProcessors.add(new AppengRecipeProcessor()); } + if (Loader.isModLoaded("Botania")) { + NotEnoughEnergistics.logger.info("Found Botania,install Botania support"); + recipeProcessors.add(new BotaniaRecipeProcessor()); + } + if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) { NotEnoughEnergistics.logger.info("Found GregTech5,install GregTech5 support"); recipeProcessors.add(new GregTech5RecipeProcessor());