From 8615546dc49038d5fc9a2632ce6fabd484afa02b Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 17:23:23 -0400 Subject: [PATCH 01/32] Remove deprecated getCycledIngredients --- .../client/integration/nei/recipe/RecipeHandlerBrewery.java | 2 +- .../client/integration/nei/recipe/RecipeHandlerElvenTrade.java | 2 +- .../integration/nei/recipe/RecipeHandlerFloatingFlowers.java | 2 +- .../client/integration/nei/recipe/RecipeHandlerManaPool.java | 2 +- .../integration/nei/recipe/RecipeHandlerPetalApothecary.java | 2 +- .../client/integration/nei/recipe/RecipeHandlerPureDaisy.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index 64e3bfe153..15680bb192 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -65,7 +65,7 @@ public void setIngredients(List inputs) { @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 81a744c5bc..39e8fd365c 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -52,7 +52,7 @@ public void setIngredients(List inputs) { @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java index 9801c436d5..2c3a3a8321 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java @@ -31,7 +31,7 @@ public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlo @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 36e83b524b..63cd7ded9d 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -56,7 +56,7 @@ else if (recipe.isConjuration()) @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 80196b8a7f..820e770850 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -56,7 +56,7 @@ public void setIngredients(List inputs) { @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index f02d24a09c..10c996d10a 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -43,7 +43,7 @@ public CachedPureDaisyRecipe(RecipePureDaisy recipe) { @Override public List getIngredients() { - return getCycledIngredients(cycleticks / 20, inputs); + return inputs; } @Override From f180c9530c2d2170c175d6b4d286acdadf060c3d Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 17:25:07 -0400 Subject: [PATCH 02/32] Remove commented out pointless elven knowledge check --- .../nei/recipe/RecipeHandlerElvenTrade.java | 56 ++++++------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 39e8fd365c..7ae460a8a0 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -94,53 +94,33 @@ public void drawBackground(int recipe) { RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48); } - private static boolean hasElvenKnowledge() { - /*EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player != null) { - for (ItemStack stack : player.inventory.mainInventory) { - if (stack != null && stack.getItem() instanceof ILexicon) { - ILexicon lexicon = (ILexicon) stack.getItem(); - if (lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) { - return true; - } - } - } - } - return false;*/ - return true; - } - @Override public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) { - if(hasElvenKnowledge()) { - for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { - arecipes.add(new CachedElvenTradeRecipe(recipe)); - } - } - } else super.loadCraftingRecipes(outputId, results); + if (outputId.equals("botania.elvenTrade")) { + for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { + arecipes.add(new CachedElvenTradeRecipe(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } } @Override public void loadCraftingRecipes(ItemStack result) { - if(hasElvenKnowledge()) { - for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { - if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) - arecipes.add(new CachedElvenTradeRecipe(recipe)); - } - } - } + for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { + if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) + arecipes.add(new CachedElvenTradeRecipe(recipe)); + } + } @Override public void loadUsageRecipes(ItemStack ingredient) { - if(hasElvenKnowledge()) { - for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { - CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe); - if(crecipe.contains(crecipe.inputs, ingredient)) - arecipes.add(crecipe); - } - } - } + for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { + CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe); + if (crecipe.contains(crecipe.inputs, ingredient)) + arecipes.add(crecipe); + } + } // hide dummy recipes private List filteredElvenTradeRecipes() { From e8f70bb3918f0fb77bfc18177bbdf81fcf5ee268 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 17:27:56 -0400 Subject: [PATCH 03/32] Remove deprecated recipiesPerPage --- .../integration/nei/recipe/RecipeHandlerElvenTrade.java | 5 ----- .../integration/nei/recipe/RecipeHandlerLexicaBotania.java | 5 ----- .../client/integration/nei/recipe/RecipeHandlerManaPool.java | 5 ----- .../integration/nei/recipe/RecipeHandlerPetalApothecary.java | 5 ----- .../integration/nei/recipe/RecipeHandlerPureDaisy.java | 5 ----- 5 files changed, 25 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 7ae460a8a0..2919bfdbe2 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -77,11 +77,6 @@ public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), "botania.elvenTrade")); } - @Override - public int recipiesPerPage() { - return 1; - } - @Override public void drawBackground(int recipe) { super.drawBackground(recipe); diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index fe5d660c3c..26edc22966 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -77,11 +77,6 @@ public String getRecipeName() { public String getGuiTexture() { return LibResources.GUI_NEI_BLANK; } - - @Override - public int recipiesPerPage() { - return 1; - } @Override public void loadTransferRects() { diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 63cd7ded9d..dc721695ee 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -81,11 +81,6 @@ public String getGuiTexture() { return LibResources.GUI_NEI_BLANK; } - @Override - public int recipiesPerPage() { - return 1; - } - @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), "botania.manaPool")); diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 820e770850..42696ea2bf 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -85,11 +85,6 @@ public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID())); } - @Override - public int recipiesPerPage() { - return 1; - } - @Override public void drawBackground(int recipe) { super.drawBackground(recipe); diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index 10c996d10a..c2fcc00e83 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -68,11 +68,6 @@ public String getGuiTexture() { return LibResources.GUI_NEI_BLANK; } - @Override - public int recipiesPerPage() { - return 2; - } - @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), "botania.pureDaisy")); From b0429f7b8255ff5b76fd71c6750963e4a8ec8c0a Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 17:34:05 -0400 Subject: [PATCH 04/32] Clean up brewery handler and show usable brew containers as catalysts --- .../client/integration/nei/IMCForNEI.java | 22 ++ .../nei/recipe/RecipeHandlerBrewery.java | 235 +++++++++--------- .../common/core/proxy/CommonProxy.java | 6 + 3 files changed, 150 insertions(+), 113 deletions(-) create mode 100644 src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java diff --git a/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java new file mode 100644 index 0000000000..f6699d7c67 --- /dev/null +++ b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java @@ -0,0 +1,22 @@ +package vazkii.botania.client.integration.nei; + +import cpw.mods.fml.common.event.FMLInterModComms; +import net.minecraft.nbt.NBTTagCompound; +import vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery; + +public class IMCForNEI { + public static void IMCSender() { + String brewery = new RecipeHandlerBrewery().getOverlayIdentifier(); + sendCatalyst(brewery, "Botania:vial", -1); + sendCatalyst(brewery, "Botania:vial:1", -1); + sendCatalyst(brewery, "Botania:incenseStick", -1); + } + + private static void sendCatalyst(String handlerName, String stack, int priority) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString("handlerID", handlerName); + nbt.setString("itemName", stack); + nbt.setInteger("priority", priority); + FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", nbt); + } +} diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index 15680bb192..e94c32364a 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -23,118 +23,127 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler { - public class CachedBreweryRecipe extends CachedRecipe { - - public List inputs = new ArrayList<>(); - public PositionedStack output; - public int mana; - - public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) { - if(recipe == null) - return; - - setIngredients(recipe.getInputs()); - ItemStack toVial; - if (vial == null) - toVial = new ItemStack(ModItems.vial); - else - toVial = vial.copy(); - toVial.stackSize = 1; - inputs.add(new PositionedStack(toVial, 39, 42)); - - output = new PositionedStack(recipe.getOutput(toVial), 87, 42); - } - - public CachedBreweryRecipe(RecipeBrew recipe) { - this(recipe, null); - } - - public void setIngredients(List inputs) { - int left = 96 - inputs.size() * 18 / 2; - - int i = 0; - for (Object o : inputs) { - if (o instanceof String) - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6)); - else - this.inputs.add(new PositionedStack(o, left + i * 18, 6)); - - i++; - } - } - - @Override - public List getIngredients() { - return inputs; - } - - @Override - public PositionedStack getResult() { - return output; - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.brewery"); - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BREWERY; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), "botania.brewery")); - } - - @Override - public void drawBackground(int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(getGuiTexture()); - GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("botania.brewery")) - for(RecipeBrew recipe : BotaniaAPI.brewRecipes) - arecipes.add(new CachedBreweryRecipe(recipe)); - else super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - if(result.getItem() instanceof IBrewItem) - for(RecipeBrew recipe : BotaniaAPI.brewRecipes) { - if(recipe == null) - continue; - - if(((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew()) - arecipes.add(new CachedBreweryRecipe(recipe)); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - if(ingredient.getItem() instanceof IBrewContainer) { - for(RecipeBrew recipe : BotaniaAPI.brewRecipes) { - if(recipe == null) - continue; - - if(recipe.getOutput(ingredient) != null) - arecipes.add(new CachedBreweryRecipe(recipe, ingredient)); - } - } else for(RecipeBrew recipe : BotaniaAPI.brewRecipes) { - if(recipe == null) - continue; - - CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe); - if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient)) - arecipes.add(crecipe); - } - } + public class CachedBreweryRecipe extends CachedRecipe { + + public List inputs = new ArrayList<>(); + public PositionedStack output; + public int mana; + + public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) { + if (recipe == null) return; + + setIngredients(recipe.getInputs()); + ItemStack toVial; + if (vial == null) { + toVial = new ItemStack(ModItems.vial); + } else { + toVial = vial.copy(); + } + toVial.stackSize = 1; + inputs.add(new PositionedStack(toVial, 39, 42)); + + output = new PositionedStack(recipe.getOutput(toVial), 87, 42); + } + + public CachedBreweryRecipe(RecipeBrew recipe) { + this(recipe, null); + } + + public void setIngredients(List inputs) { + int left = 96 - inputs.size() * 18 / 2; + + int i = 0; + for (Object o : inputs) { + if (o instanceof String) { + this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6)); + } else { + this.inputs.add(new PositionedStack(o, left + i * 18, 6)); + } + i++; + } + } + + @Override + public List getIngredients() { + return inputs; + } + + @Override + public PositionedStack getResult() { + return output; + } + + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.brewery"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.brewery"; + } + + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BREWERY; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { + arecipes.add(new CachedBreweryRecipe(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + if (!(result.getItem() instanceof IBrewItem)) { + return; + } + for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { + if (recipe != null && ((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew()) { + arecipes.add(new CachedBreweryRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + if (ingredient.getItem() instanceof IBrewContainer) { + for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { + if (recipe != null && recipe.getOutput(ingredient) != null) { + arecipes.add(new CachedBreweryRecipe(recipe, ingredient)); + } + } + } else { + for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { + if (recipe == null) + continue; + + CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe); + if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient)) { + arecipes.add(crecipe); + } + } + } + } } diff --git a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java index 24c14e5f4d..19f743fee4 100644 --- a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java @@ -33,6 +33,7 @@ import vazkii.botania.api.lexicon.ITwoNamedPage; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.client.integration.nei.IMCForNEI; import vazkii.botania.common.Botania; import vazkii.botania.common.achievement.ModAchievements; import vazkii.botania.common.block.ModBlocks; @@ -84,6 +85,7 @@ import vazkii.botania.common.world.WorldTypeSkyblock; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -152,6 +154,10 @@ public void init(FMLInitializationEvent event) { new StatementAPIPlugin(); LexiconData.init(); + + if (Loader.isModLoaded("NotEnoughItems")) { + IMCForNEI.IMCSender(); + } } public void postInit(FMLPostInitializationEvent event) { From 992a319a3ba9dd492e34b1a760fe3b3f6dd87240 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 18:10:56 -0400 Subject: [PATCH 05/32] Clean up elven trade handler and replace stream with loop --- .../nei/recipe/RecipeHandlerElvenTrade.java | 207 +++++++++--------- 1 file changed, 108 insertions(+), 99 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 2919bfdbe2..a44d078446 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; @@ -26,119 +25,129 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler { - public class CachedElvenTradeRecipe extends CachedRecipe { - - public List inputs = new ArrayList<>(); - public PositionedStack output; - - public CachedElvenTradeRecipe(RecipeElvenTrade recipe) { - if(recipe == null) - return; - - setIngredients(recipe.getInputs()); - output = new PositionedStack(recipe.getOutput(), 107, 46); - } - - public void setIngredients(List inputs) { - int i = 0; - for(Object o : inputs) { - if(o instanceof String) - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6)); - else this.inputs.add(new PositionedStack(o, 60 + i * 18, 6)); - - i++; - } - } - - @Override - public List getIngredients() { - return inputs; - } - - @Override - public PositionedStack getResult() { - return output; - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.elvenTrade"); - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BLANK; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), "botania.elvenTrade")); - } - - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - GL11.glEnable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F); - GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY); - GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80); - GL11.glDisable(GL11.GL_BLEND); - GuiDraw.changeTexture(TextureMap.locationBlocksTexture); - RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("botania.elvenTrade")) { + public class CachedElvenTradeRecipe extends CachedRecipe { + + public List inputs = new ArrayList<>(); + public PositionedStack output; + + public CachedElvenTradeRecipe(RecipeElvenTrade recipe) { + if (recipe == null) + return; + + setIngredients(recipe.getInputs()); + output = new PositionedStack(recipe.getOutput(), 107, 46); + } + + public void setIngredients(List inputs) { + int i = 0; + for (Object o : inputs) { + if (o instanceof String) { + this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6)); + } else { + this.inputs.add(new PositionedStack(o, 60 + i * 18, 6)); + } + + i++; + } + } + + @Override + public List getIngredients() { + return inputs; + } + + @Override + public PositionedStack getResult() { + return output; + } + + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.elvenTrade"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.elvenTrade"; + } + + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BLANK; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F); + GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY); + GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80); + GL11.glDisable(GL11.GL_BLEND); + GuiDraw.changeTexture(TextureMap.locationBlocksTexture); + RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { arecipes.add(new CachedElvenTradeRecipe(recipe)); } } else { - super.loadCraftingRecipes(outputId, results); - } - } + super.loadCraftingRecipes(outputId, results); + } + } - @Override - public void loadCraftingRecipes(ItemStack result) { + @Override + public void loadCraftingRecipes(ItemStack result) { for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { - if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) + if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) { arecipes.add(new CachedElvenTradeRecipe(recipe)); + } } } - @Override - public void loadUsageRecipes(ItemStack ingredient) { + @Override + public void loadUsageRecipes(ItemStack ingredient) { for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) { CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe); - if (crecipe.contains(crecipe.inputs, ingredient)) + if (crecipe.contains(crecipe.inputs, ingredient)) { arecipes.add(crecipe); + } + } + } + + private List filteredElvenTradeRecipes() { + List result = new ArrayList<>(); + + for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) { + if (recipe == null) { + continue; + } + + // Don't show dummy recipes where input and output are the same + if (recipe.getInputs().size() != 1 || !stackSame(recipe.getOutput(), recipe.getInputs().get(0))) { + result.add(recipe); + } } + + return result; } - // hide dummy recipes - private List filteredElvenTradeRecipes() { - return BotaniaAPI.elvenTradeRecipes - .stream() - .filter(recipe -> { - if (recipe == null) { - return false; - } - if (recipe.getInputs().size() == 1) { - return !stackSame(recipe.getOutput(), recipe.getInputs().get(0)); - } - return true; - }) - .collect(Collectors.toList()); - } - - private boolean stackSame(ItemStack stack, Object obj) { - if (obj instanceof String) { - return OreDictionary.getOres((String) obj).stream().anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); - } else { - return Arrays.stream(NEIServerUtils.extractRecipeItems(obj)).anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); - } - } + private boolean stackSame(ItemStack stack, Object obj) { + if (obj instanceof String) { + return OreDictionary.getOres((String) obj).stream().anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); + } else { + return Arrays.stream(NEIServerUtils.extractRecipeItems(obj)).anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); + } + } } From aa7508a1d365cc68eaf1133a5b898ea1d69259d6 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 18:25:07 -0400 Subject: [PATCH 06/32] Clean up floating flower handler and let it work with the inventory crafting grid --- .../recipe/RecipeHandlerFloatingFlowers.java | 105 +++++++++--------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java index 2c3a3a8321..e3dd9daf19 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerFloatingFlowers.java @@ -17,65 +17,70 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler { - public class CachedFloatingFlowerRecipe extends CachedRecipe { + public class CachedFloatingFlowerRecipe extends CachedRecipe { - public List inputs = new ArrayList<>(); - public PositionedStack output; + public List inputs = new ArrayList<>(); + public PositionedStack output; - public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) { - inputs.add(new PositionedStack(floatingFlower, 25, 6)); - inputs.add(new PositionedStack(specialFlower, 43, 6)); - this.output = new PositionedStack(output, 119, 24); - this.output.setMaxSize(1); - } + public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) { + inputs.add(new PositionedStack(floatingFlower, 25, 6)); + inputs.add(new PositionedStack(specialFlower, 43, 6)); + this.output = new PositionedStack(output, 119, 24); + this.output.setMaxSize(1); + } - @Override - public List getIngredients() { - return inputs; - } + @Override + public List getIngredients() { + return inputs; + } - @Override - public PositionedStack getResult() { - return output; - } + @Override + public PositionedStack getResult() { + return output; + } - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.floatingFlowers"); - } + } - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting")); - } + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.floatingFlowers"); + } @Override - public String getGuiTexture() { - return "textures/gui/container/crafting_table.png"; + public String getOverlayIdentifier() { + return "crafting2x2"; } - @Override - public void loadCraftingRecipes(ItemStack result) { - if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) { - ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE); - ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower); - specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy()); - - arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy())); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) { - ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE); - ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower); - result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy()); - - arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result)); - } - } + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting")); + } + + @Override + public String getGuiTexture() { + return "textures/gui/container/crafting_table.png"; + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) { + ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE); + ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower); + specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy()); + + arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy())); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) { + ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE); + ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower); + result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy()); + + arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result)); + } + } } From 95ef44f43c14e8ad38eb6f41ae5243836422855f Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 18:57:15 -0400 Subject: [PATCH 07/32] Clean up lexica info handler, make the transfer rect actually work by just rendering the lexica item rather than adding it as an itemstack, and show information when looking both for recipes and usages --- .../recipe/RecipeHandlerLexicaBotania.java | 238 +++++++++--------- 1 file changed, 124 insertions(+), 114 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index 26edc22966..e34452d4dc 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -2,22 +2,22 @@ * This class was created by . It's distributed as * part of the Botania Mod. Get the Source Code in github: * https://github.com/Vazkii/Botania - * + *

* Botania is Open Source and distributed under the * Botania License: http://botaniamod.net/license.php - * + *

* File Created @ [12/12/2015, 23:25:47 (GMT)] */ package vazkii.botania.client.integration.nei.recipe; import java.awt.Rectangle; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; @@ -34,116 +34,126 @@ public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler { - public class CachedLexicaBotaniaRecipe extends CachedRecipe { - - public LexiconEntry entry; - public PositionedStack item; - public List otherStacks = new ArrayList<>(); - - public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) { - otherStacks.add(new PositionedStack(new ItemStack(ModItems.lexicon), 51, 5)); - item = new PositionedStack(stack, 91, 5); - this.entry = entry; - } - - @Override - public List getIngredients() { - return otherStacks; - } - - @Override - public PositionedStack getResult() { - return item; - } - - @Override - public List getOtherStacks() { - return otherStacks; - } - - @Override - public boolean contains(Collection ingredients, ItemStack ingredient) { - return ingredient.getItem() == ModItems.lexicon; - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.lexica"); - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BLANK; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), "botania.lexica")); - } - - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - - FontRenderer font = Minecraft.getMinecraft().fontRenderer; - CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe)); - - String s = EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()); - font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 4210752); - - KnowledgeType type = recipeObj.entry.getKnowledgeType(); - s = type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("\\&.", ""); - font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 4210752); - - s = "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\""; - PageText.renderText(5, 42, 160, 200, s); - - String key = LexiconRecipeMappings.stackToString(recipeObj.item.item); - String quickInfo = "botania.nei.quickInfo:" + key; - String quickInfoLocal = StatCollector.translateToLocal(quickInfo); - - if(GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips) - s = "name: " + key; - else if(quickInfo.equals(quickInfoLocal)) - s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo"); - else { - s = StatCollector.translateToLocal("botania.nei.lexicaSeparator"); - font.drawString(s, 82 - font.getStringWidth(s) / 2, 80, 4210752); - s = quickInfoLocal; - } - - PageText.renderText(5, 80, 160, 200, s); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("botania.lexica")) { - for(LexiconEntry entry : BotaniaAPI.getAllEntries()) { - List stacks = entry.getDisplayedRecipes(); - for(ItemStack stack : stacks) - arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry)); - } - } else super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for(LexiconEntry entry : BotaniaAPI.getAllEntries()) { - List stacks = entry.getDisplayedRecipes(); - for(ItemStack stack : stacks) { - String key1 = LexiconRecipeMappings.stackToString(stack); - String key2 = LexiconRecipeMappings.stackToString(result); - if(key1.equals(key2)) - arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry)); - } - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - // NO-OP - } + private static final RenderItem renderItem = new RenderItem(); + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final ItemStack lexicaStack = new ItemStack(ModItems.lexicon); + + public class CachedLexicaBotaniaRecipe extends CachedRecipe { + + public LexiconEntry entry; + public PositionedStack item; + + public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) { + item = new PositionedStack(stack, 91, 5); + this.entry = entry; + } + + @Override + public PositionedStack getResult() { + return item; + } + + @Override + public boolean contains(Collection ingredients, ItemStack ingredient) { + return ingredient.getItem() == ModItems.lexicon; + } + + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.lexica"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.lexica"; + } + + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BLANK; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe)); + + renderItem.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), lexicaStack, 51, 5); + + String s = EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()); + font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 0x404040); + + KnowledgeType type = recipeObj.entry.getKnowledgeType(); + s = type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&.", ""); + font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 0x404040); + + s = "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\""; + PageText.renderText(5, 42, 160, 200, s); + + String key = LexiconRecipeMappings.stackToString(recipeObj.item.item); + String quickInfo = "botania.nei.quickInfo:" + key; + String quickInfoLocal = StatCollector.translateToLocal(quickInfo); + + if (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips) + s = "name: " + key; + else if (quickInfo.equals(quickInfoLocal)) + s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo"); + else { + font.drawString( + StatCollector.translateToLocal("botania.nei.lexicaSeparator"), + 82 - font.getStringWidth(s) / 2, + 80, + 0x404040); + s = quickInfoLocal; + } + + PageText.renderText(5, 80, 160, 200, s); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (LexiconEntry entry : BotaniaAPI.getAllEntries()) { + List stacks = entry.getDisplayedRecipes(); + for (ItemStack stack : stacks) + arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (LexiconEntry entry : BotaniaAPI.getAllEntries()) { + List stacks = entry.getDisplayedRecipes(); + for (ItemStack stack : stacks) { + String key1 = LexiconRecipeMappings.stackToString(stack); + String key2 = LexiconRecipeMappings.stackToString(result); + if (key1.equals(key2)) { + arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry)); + } + } + } + } + + @Override + public void loadUsageRecipes(String outputId, Object... ingredients) { + loadCraftingRecipes(outputId, ingredients); + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + loadCraftingRecipes(ingredient); + } } From 9fca30df29426bad97a6da18dbbbb0a26f9a403e Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 19:52:20 -0400 Subject: [PATCH 08/32] Clean up mana pool handler and make the transfer rect actually work by just rendering the mana pool item rather than adding it as an itemstack # Conflicts: # src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java --- .../nei/recipe/RecipeHandlerManaPool.java | 242 ++++++++++-------- 1 file changed, 129 insertions(+), 113 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index dc721695ee..05aea0bc24 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -1,13 +1,12 @@ package vazkii.botania.client.integration.nei.recipe; import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.item.Item; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; @@ -28,115 +27,132 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { - public class CachedManaPoolRecipe extends CachedRecipe { - - public List inputs = new ArrayList<>(); - public PositionedStack output; - public List otherStacks = new ArrayList<>(); - public int mana; - - public CachedManaPoolRecipe(RecipeManaInfusion recipe) { - if(recipe == null) - return; - inputs.add(new PositionedStack(new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), 71, 37)); - - if(recipe.getInput() instanceof String) - inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37)); - else inputs.add(new PositionedStack(recipe.getInput(), 42, 37)); - - if(recipe.isAlchemy()) - otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37)); - else if (recipe.isConjuration()) - otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37)); - - output = new PositionedStack(recipe.getOutput(), 101, 37); - // This value is where the mana bar is stored initially - mana = recipe.getManaToConsume(); - } - - @Override - public List getIngredients() { - return inputs; - } - - @Override - public PositionedStack getResult() { - return output; - } - - @Override - public List getOtherStacks() { - return otherStacks; - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.manaPool"); - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BLANK; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), "botania.manaPool")); - } - - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - GL11.glEnable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); - // Mana infusion is the mana pool, super weird. - GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY); - GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50); - // Below is where the mana bar actually drawn. - int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana; - HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, TilePool.MAX_MANA / 10); - FontRenderer font = Minecraft.getMinecraft().fontRenderer; - String size = GuiScreen.isShiftKeyDown() ? "1x" : "10x"; - String localized = StatCollector.translateToLocalFormatted("botaniamisc.neiratio", size); - font.drawString(localized, 84 - font.getStringWidth(localized) / 2, 71, 0x000000); - RenderTilePool.forceMana = true; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("botania.manaPool")) { - for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { - if(recipe == null) - continue; - - arecipes.add(new CachedManaPoolRecipe(recipe)); - } - } else super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { - if(recipe == null) - continue; - - if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) - arecipes.add(new CachedManaPoolRecipe(recipe)); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { - if(recipe == null) - continue; - - CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe); - if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) - arecipes.add(crecipe); - } - } + private static final RenderItem renderItem = new RenderItem(); + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final ItemStack poolStack = new ItemStack(ModBlocks.pool); + + public class CachedManaPoolRecipe extends CachedRecipe { + + public PositionedStack input; + public PositionedStack output; + public PositionedStack catalyst; + public int mana; + + public CachedManaPoolRecipe(RecipeManaInfusion recipe) { + if (recipe == null) return; + + if (recipe.getInput() instanceof String) { + input = new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37); + } else { + input = new PositionedStack(recipe.getInput(), 42, 37); + } + + if (recipe.isAlchemy()) { + catalyst = new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37); + } else if (recipe.isConjuration()) { + catalyst = new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37); + } + + output = new PositionedStack(recipe.getOutput(), 101, 37); + mana = recipe.getManaToConsume(); + } + + @Override + public PositionedStack getIngredient() { + return input; + } + + @Override + public PositionedStack getResult() { + return output; + } + + @Override + public PositionedStack getOtherStack() { + return catalyst; + } + + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.manaPool"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.manaPool"; + } + + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BLANK; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + // Arrows + GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY); + GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50); + // Mana bar + int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana; + HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, TilePool.MAX_MANA / 10); + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + String size = GuiScreen.isShiftKeyDown() ? "1x" : "10x"; + String localized = StatCollector.translateToLocalFormatted("botaniamisc.neiratio", size); + font.drawString(localized, 84 - font.getStringWidth(localized) / 2, 71, 0x000000); + GL11.glDisable(GL11.GL_BLEND); + // Mana pool item + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderTilePool.forceMana = true; + renderItem.renderItemIntoGUI(font, mc.getTextureManager(), poolStack, 71, 37); + GL11.glDisable(GL11.GL_DEPTH_TEST); + RenderHelper.disableStandardItemLighting(); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { + if (recipe == null) continue; + + arecipes.add(new CachedManaPoolRecipe(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { + if (recipe == null) continue; + + if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) { + arecipes.add(new CachedManaPoolRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { + if (recipe == null) continue; + + CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe); + if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) { + arecipes.add(crecipe); + } + } + } } From 64795d2cf616e9ec767aeec63c90a06f94afd35d Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 21:39:57 -0400 Subject: [PATCH 09/32] Move duplicate references to helper class and clean up string display --- .../client/integration/nei/NEIHelper.java | 13 ++++++ .../recipe/RecipeHandlerLexicaBotania.java | 44 ++++++++++++------- .../nei/recipe/RecipeHandlerManaPool.java | 19 ++++---- 3 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java diff --git a/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java new file mode 100644 index 0000000000..cd369c687a --- /dev/null +++ b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java @@ -0,0 +1,13 @@ +package vazkii.botania.client.integration.nei; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; + +public class NEIHelper { + public static final RenderItem renderItem = new RenderItem(); + public static final Minecraft mc = Minecraft.getMinecraft(); + public static final TextureManager textureManager = mc.getTextureManager(); + public static final FontRenderer font = mc.fontRenderer; +} diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index e34452d4dc..ad619642c1 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -15,9 +15,7 @@ import java.util.List; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; @@ -26,16 +24,15 @@ import vazkii.botania.api.lexicon.KnowledgeType; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconRecipeMappings; +import vazkii.botania.client.integration.nei.NEIHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lexicon.page.PageText; +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler { - - private static final RenderItem renderItem = new RenderItem(); - private static final Minecraft mc = Minecraft.getMinecraft(); private static final ItemStack lexicaStack = new ItemStack(ModItems.lexicon); public class CachedLexicaBotaniaRecipe extends CachedRecipe { @@ -84,35 +81,48 @@ public void loadTransferRects() { public void drawBackground(int recipe) { super.drawBackground(recipe); - FontRenderer font = Minecraft.getMinecraft().fontRenderer; CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe)); - renderItem.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), lexicaStack, 51, 5); + NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, lexicaStack, 51, 5); - String s = EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()); - font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 0x404040); + GuiDraw.drawStringC( + EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()), + 82, + 30, + 0x404040, + false); KnowledgeType type = recipeObj.entry.getKnowledgeType(); - s = type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&.", ""); - font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 0x404040); - - s = "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\""; - PageText.renderText(5, 42, 160, 200, s); + GuiDraw.drawStringC( + type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&.", ""), + 82, + 42, + 0x404040, + false); + + PageText.renderText( + 5, + 42, + 160, + 200, + "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\""); String key = LexiconRecipeMappings.stackToString(recipeObj.item.item); String quickInfo = "botania.nei.quickInfo:" + key; String quickInfoLocal = StatCollector.translateToLocal(quickInfo); + String s; if (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips) s = "name: " + key; else if (quickInfo.equals(quickInfoLocal)) s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo"); else { - font.drawString( + GuiDraw.drawStringC( StatCollector.translateToLocal("botania.nei.lexicaSeparator"), - 82 - font.getStringWidth(s) / 2, + 82, 80, - 0x404040); + 0x404040, + false); s = quickInfoLocal; } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 05aea0bc24..370341ebbf 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -2,11 +2,8 @@ import java.awt.Rectangle; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; @@ -16,6 +13,7 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.client.core.handler.HUDHandler; +import vazkii.botania.client.integration.nei.NEIHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.client.render.tile.RenderTilePool; import vazkii.botania.common.block.ModBlocks; @@ -27,8 +25,6 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { - private static final RenderItem renderItem = new RenderItem(); - private static final Minecraft mc = Minecraft.getMinecraft(); private static final ItemStack poolStack = new ItemStack(ModBlocks.pool); public class CachedManaPoolRecipe extends CachedRecipe { @@ -104,17 +100,22 @@ public void drawBackground(int recipe) { GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50); // Mana bar int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana; - HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, TilePool.MAX_MANA / 10); - FontRenderer font = Minecraft.getMinecraft().fontRenderer; + HUDHandler.renderManaBar( + 32, + 80, + 0x0000FF, + 0.75F, + GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, + TilePool.MAX_MANA / 10); String size = GuiScreen.isShiftKeyDown() ? "1x" : "10x"; String localized = StatCollector.translateToLocalFormatted("botaniamisc.neiratio", size); - font.drawString(localized, 84 - font.getStringWidth(localized) / 2, 71, 0x000000); + GuiDraw.drawStringC(localized, 84, 71, 0x000000, false); GL11.glDisable(GL11.GL_BLEND); // Mana pool item RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderTilePool.forceMana = true; - renderItem.renderItemIntoGUI(font, mc.getTextureManager(), poolStack, 71, 37); + NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, poolStack, 71, 37); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderHelper.disableStandardItemLighting(); } From d8b9f5bb11cc9acf3432273347f7818ba0940a07 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 22:13:30 -0400 Subject: [PATCH 10/32] Clean up apothecary and runic altar handlers. Remove the altars from the recipe ingredients and add seeds/livingrock. --- .../recipe/RecipeHandlerPetalApothecary.java | 255 ++++++++++-------- .../nei/recipe/RecipeHandlerRunicAltar.java | 79 +++--- .../resources/assets/botania/lang/en_US.lang | 2 + 3 files changed, 187 insertions(+), 149 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 42696ea2bf..e20ce714fc 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; @@ -13,6 +14,7 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipePetals; +import vazkii.botania.client.integration.nei.NEIHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.block.ModBlocks; import codechicken.lib.gui.GuiDraw; @@ -22,117 +24,146 @@ import vazkii.botania.common.core.helper.ItemNBTHelper; public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { - - public class CachedPetalApothecaryRecipe extends CachedRecipe { - - public List inputs = new ArrayList<>(); - public PositionedStack output; - - public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) { - setIngredients(recipe.getInputs()); - output = new PositionedStack(recipe.getOutput(), 111, 21); - if(addCenterItem) - inputs.add(new PositionedStack(new ItemStack(ModBlocks.altar), 73, 55)); - } - - public CachedPetalApothecaryRecipe(RecipePetals recipe) { - this(recipe, true); - } - - public void setIngredients(List inputs) { - float degreePerInput = 360F / inputs.size(); - float currentDegree = -90F; - - for(Object o : inputs) { - int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32); - int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32); - - if(o instanceof String) - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY)); - else this.inputs.add(new PositionedStack(o, posX, posY)); - currentDegree += degreePerInput; - } - } - - @Override - public List getIngredients() { - return inputs; - } - - @Override - public PositionedStack getResult() { - return output; - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.petalApothecary"); - } - - public String getRecipeID() { - return "botania.petalApothecary"; - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BLANK; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID())); - } - - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - GL11.glEnable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); - GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY); - GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92); - } - - public List getRecipes() { - return BotaniaAPI.petalRecipes; - } - - public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { - return new CachedPetalApothecaryRecipe(recipe); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals(getRecipeID())) { - for(RecipePetals recipe : getRecipes()) - if(recipe.getOutput().getItem() != Items.skull) - arecipes.add(getCachedRecipe(recipe)); - } else super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - for(RecipePetals recipe : getRecipes()){ - if(recipe == null) - continue; - - if(recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) - arecipes.add(getCachedRecipe(recipe)); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for(RecipePetals recipe : getRecipes()) { - if(recipe == null) - continue; - - CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe); - if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) - arecipes.add(crecipe); - } - } - + private static final ItemStack altarStack = new ItemStack(ModBlocks.altar); + + public abstract class CachedCircleRecipe extends CachedRecipe { + + public List inputs = new ArrayList<>(); + public PositionedStack output; + public boolean renderItem; + + public CachedCircleRecipe(RecipePetals recipe) { + setIngredients(recipe.getInputs()); + output = new PositionedStack(recipe.getOutput(), 111, 21); + renderItem = true; + } + + public void setIngredients(List inputs) { + float degreePerInput = 360F / inputs.size(); + float currentDegree = -90F; + + for (Object o : inputs) { + int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32); + int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32); + + if (o instanceof String) { + this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY)); + } else { + this.inputs.add(new PositionedStack(o, posX, posY)); + } + currentDegree += degreePerInput; + } + } + + @Override + public List getIngredients() { + return inputs; + } + + @Override + public PositionedStack getResult() { + return output; + } + } + + public class CachedPetalApothecaryRecipe extends CachedCircleRecipe { + ItemStack seedStack = new ItemStack(Items.wheat_seeds); + + public CachedPetalApothecaryRecipe(RecipePetals recipe) { + super(recipe); + seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed")); + inputs.add(new PositionedStack(seedStack, 73, 39)); + } + + // Used by the Alfheim addon + @SuppressWarnings("unused") + public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) { + super(recipe); + renderItem = addCenterItem; + } + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.petalApothecary"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.petalApothecary"; + } + + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BLANK; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(73, 56, 16, 16), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + // Background circle graphic + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY); + GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92); + // Item + if (!((CachedCircleRecipe) arecipes.get(recipe)).renderItem) return; + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL11.GL_DEPTH_TEST); + NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, getRenderItem(), 73, 55); + GL11.glDisable(GL11.GL_DEPTH_TEST); + RenderHelper.disableStandardItemLighting(); + } + + protected ItemStack getRenderItem() { + return altarStack; + } + + public List getRecipes() { + return BotaniaAPI.petalRecipes; + } + + public CachedCircleRecipe getCachedRecipe(RecipePetals recipe) { + return new CachedPetalApothecaryRecipe(recipe); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (RecipePetals recipe : getRecipes()) + if (recipe.getOutput().getItem() != Items.skull) + arecipes.add(getCachedRecipe(recipe)); + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (RecipePetals recipe : getRecipes()) { + if (recipe == null) continue; + + if (recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) { + arecipes.add(getCachedRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (RecipePetals recipe : getRecipes()) { + if (recipe == null) continue; + + CachedCircleRecipe crecipe = getCachedRecipe(recipe); + if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) { + arecipes.add(crecipe); + } + } + } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java index 506ad540df..b1b5fc08d4 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java @@ -14,44 +14,49 @@ public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary { - public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe { - - public int manaUsage; - - public CachedRunicAltarRecipe(RecipeRuneAltar recipe) { - super(recipe, false); - if(recipe == null) - return; - manaUsage = recipe.getManaUsage(); - inputs.add(new PositionedStack(new ItemStack(ModBlocks.runeAltar), 73, 55)); - } - - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.runicAltar"); - } - - @Override - public String getRecipeID() { - return "botania.runicAltar"; - } - - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10); - } - - @Override - public List getRecipes() { - return BotaniaAPI.runeAltarRecipes; - } + private static final ItemStack altarStack = new ItemStack(ModBlocks.runeAltar); + + public class CachedRunicAltarRecipe extends CachedCircleRecipe { + + public int manaUsage; + private static final PositionedStack livingrock = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39); + + public CachedRunicAltarRecipe(RecipeRuneAltar recipe) { + super(recipe); + inputs.add(livingrock); + manaUsage = recipe.getManaUsage(); + } + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.runicAltar"); + } + + @Override + public String getOverlayIdentifier() { + return "botania.runicAltar"; + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10); + } + + @Override + public List getRecipes() { + return BotaniaAPI.runeAltarRecipes; + } + + @Override + public CachedCircleRecipe getCachedRecipe(RecipePetals recipe) { + return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe); + } @Override - public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { - return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe); - } + protected ItemStack getRenderItem() { + return altarStack; + } } diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 9fb5df7f68..fdd5245ba9 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -184,6 +184,8 @@ botania.nei.pureDaisy=Pure Daisy botania.nei.lexica=Lexica Botania nei.options.keys.gui.botania_corporea_request=Corporea Request +botania.nei.anySeed=Any Seed + botania.nei.lexicaSeparator=Extra Info: botania.nei.lexicaNoInfo=(there's no Extra Info for this entry, sorry!) From f5ec5fb95f165dd870e1adba29c68f41b887e4b9 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 20 Mar 2026 22:48:16 -0400 Subject: [PATCH 11/32] Clean up pure daisy handler. Add helper method to render items. --- .../client/integration/nei/NEIHelper.java | 5 + .../recipe/RecipeHandlerLexicaBotania.java | 2 +- .../nei/recipe/RecipeHandlerManaPool.java | 2 +- .../recipe/RecipeHandlerPetalApothecary.java | 2 +- .../nei/recipe/RecipeHandlerPureDaisy.java | 168 ++++++++++-------- 5 files changed, 97 insertions(+), 82 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java index cd369c687a..4432d9464c 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java +++ b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java @@ -4,10 +4,15 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.item.ItemStack; public class NEIHelper { public static final RenderItem renderItem = new RenderItem(); public static final Minecraft mc = Minecraft.getMinecraft(); public static final TextureManager textureManager = mc.getTextureManager(); public static final FontRenderer font = mc.fontRenderer; + + public static void renderItemIntoGUI(ItemStack flowerStack, int x, int y) { + renderItem.renderItemIntoGUI(font, textureManager, flowerStack, x, y); + } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index ad619642c1..6a16b19908 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -83,7 +83,7 @@ public void drawBackground(int recipe) { CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe)); - NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, lexicaStack, 51, 5); + NEIHelper.renderItemIntoGUI(lexicaStack, 51, 5); GuiDraw.drawStringC( EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()), diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 370341ebbf..8857a8f32f 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -115,7 +115,7 @@ public void drawBackground(int recipe) { RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderTilePool.forceMana = true; - NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, poolStack, 71, 37); + NEIHelper.renderItemIntoGUI(poolStack, 71, 37); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderHelper.disableStandardItemLighting(); } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index e20ce714fc..7c638cc6d0 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -115,7 +115,7 @@ public void drawBackground(int recipe) { if (!((CachedCircleRecipe) arecipes.get(recipe)).renderItem) return; RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); - NEIHelper.renderItem.renderItemIntoGUI(NEIHelper.font, NEIHelper.textureManager, getRenderItem(), 73, 55); + NEIHelper.renderItemIntoGUI(getRenderItem(), 73, 55); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderHelper.disableStandardItemLighting(); } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index c2fcc00e83..8b0fc8bf72 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -13,6 +13,7 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipePureDaisy; +import vazkii.botania.client.integration.nei.NEIHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; @@ -23,98 +24,107 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { - public class CachedPureDaisyRecipe extends CachedRecipe { + private static final ItemStack flowerStack = ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY); - public List inputs = new ArrayList<>(); - public PositionedStack output; - public List otherStacks = new ArrayList<>(); + public class CachedPureDaisyRecipe extends CachedRecipe { - public CachedPureDaisyRecipe(RecipePureDaisy recipe) { - if(recipe == null) - return; - inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), 71, 23)); + public List inputs = new ArrayList<>(); + public PositionedStack output; + public List otherStacks = new ArrayList<>(); - if(recipe.getInput() instanceof String) - inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23)); - else inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23)); + public CachedPureDaisyRecipe(RecipePureDaisy recipe) { + if (recipe == null) return; - output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23); - } + if (recipe.getInput() instanceof String) { + inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23)); + } else { + inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23)); + } - @Override - public List getIngredients() { - return inputs; - } + output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23); + } - @Override - public PositionedStack getResult() { - return output; - } + @Override + public List getIngredients() { + return inputs; + } - @Override - public List getOtherStacks() { - return otherStacks; - } + @Override + public PositionedStack getResult() { + return output; + } - } - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal("botania.nei.pureDaisy"); - } - - @Override - public String getGuiTexture() { - return LibResources.GUI_NEI_BLANK; - } - - @Override - public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), "botania.pureDaisy")); - } + @Override + public List getOtherStacks() { + return otherStacks; + } - @Override - public void drawBackground(int recipe) { - super.drawBackground(recipe); - GL11.glEnable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); - GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY); - GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44); - } + } - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("botania.pureDaisy")) { - for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { - if(recipe == null) - continue; - - arecipes.add(new CachedPureDaisyRecipe(recipe)); - } - } else super.loadCraftingRecipes(outputId, results); - } + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("botania.nei.pureDaisy"); + } @Override - public void loadCraftingRecipes(ItemStack result) { - for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { - if(recipe == null) - continue; - - if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result)) - arecipes.add(new CachedPureDaisyRecipe(recipe)); - } + public String getOverlayIdentifier() { + return "botania.pureDaisy"; } - @Override - public void loadUsageRecipes(ItemStack ingredient) { - for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { - if(recipe == null) - continue; - - CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe); - if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) - arecipes.add(crecipe); - } - } + @Override + public String getGuiTexture() { + return LibResources.GUI_NEI_BLANK; + } + + @Override + public void loadTransferRects() { + transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), getOverlayIdentifier())); + } + + @Override + public void drawBackground(int recipe) { + super.drawBackground(recipe); + // Arrows + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY); + GuiDraw.drawTexturedModalRect(48, 10, 0, 0, 65, 44); + // Flower item + NEIHelper.renderItemIntoGUI(flowerStack, 71, 23); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { + if (recipe != null) arecipes.add(new CachedPureDaisyRecipe(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { + if (recipe == null) continue; + + if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result)) { + arecipes.add(new CachedPureDaisyRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) { + if (recipe == null) continue; + + CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe); + if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) { + arecipes.add(crecipe); + } + } + } } From 56566199995e28b9ee97a1343c07145769bd46ab Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Sat, 21 Mar 2026 00:53:50 -0400 Subject: [PATCH 12/32] Fix crash with Alfheim mod by working around stupid decisions made a decade ago --- .../recipe/RecipeHandlerPetalApothecary.java | 47 +++++++++---------- .../nei/recipe/RecipeHandlerRunicAltar.java | 7 +-- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 7c638cc6d0..08559cd96c 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -26,16 +26,24 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { private static final ItemStack altarStack = new ItemStack(ModBlocks.altar); - public abstract class CachedCircleRecipe extends CachedRecipe { - + public class CachedPetalApothecaryRecipe extends CachedRecipe { public List inputs = new ArrayList<>(); public PositionedStack output; public boolean renderItem; - public CachedCircleRecipe(RecipePetals recipe) { + public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) { setIngredients(recipe.getInputs()); output = new PositionedStack(recipe.getOutput(), 111, 21); - renderItem = true; + renderItem = addCenterItem; + if (addCenterItem) { + ItemStack seedStack = new ItemStack(Items.wheat_seeds); + seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed")); + inputs.add(new PositionedStack(seedStack, 73, 39)); + } + } + + public CachedPetalApothecaryRecipe(RecipePetals recipe) { + this(recipe, true); } public void setIngredients(List inputs) { @@ -66,23 +74,6 @@ public PositionedStack getResult() { } } - public class CachedPetalApothecaryRecipe extends CachedCircleRecipe { - ItemStack seedStack = new ItemStack(Items.wheat_seeds); - - public CachedPetalApothecaryRecipe(RecipePetals recipe) { - super(recipe); - seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed")); - inputs.add(new PositionedStack(seedStack, 73, 39)); - } - - // Used by the Alfheim addon - @SuppressWarnings("unused") - public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) { - super(recipe); - renderItem = addCenterItem; - } - } - @Override public String getRecipeName() { return StatCollector.translateToLocal("botania.nei.petalApothecary"); @@ -90,6 +81,12 @@ public String getRecipeName() { @Override public String getOverlayIdentifier() { + return getRecipeID(); + } + + // Used by the Alfheim addon + @Deprecated + public String getRecipeID() { return "botania.petalApothecary"; } @@ -112,7 +109,7 @@ public void drawBackground(int recipe) { GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY); GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92); // Item - if (!((CachedCircleRecipe) arecipes.get(recipe)).renderItem) return; + if (!((CachedPetalApothecaryRecipe) arecipes.get(recipe)).renderItem) return; RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); NEIHelper.renderItemIntoGUI(getRenderItem(), 73, 55); @@ -128,8 +125,8 @@ public List getRecipes() { return BotaniaAPI.petalRecipes; } - public CachedCircleRecipe getCachedRecipe(RecipePetals recipe) { - return new CachedPetalApothecaryRecipe(recipe); + public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { + return new CachedPetalApothecaryRecipe(recipe, true); } @Override @@ -159,7 +156,7 @@ public void loadUsageRecipes(ItemStack ingredient) { for (RecipePetals recipe : getRecipes()) { if (recipe == null) continue; - CachedCircleRecipe crecipe = getCachedRecipe(recipe); + CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe); if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) { arecipes.add(crecipe); } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java index b1b5fc08d4..598029d24b 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java @@ -16,15 +16,16 @@ public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary { private static final ItemStack altarStack = new ItemStack(ModBlocks.runeAltar); - public class CachedRunicAltarRecipe extends CachedCircleRecipe { + public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe { public int manaUsage; private static final PositionedStack livingrock = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39); public CachedRunicAltarRecipe(RecipeRuneAltar recipe) { - super(recipe); + super(recipe, false); inputs.add(livingrock); manaUsage = recipe.getManaUsage(); + renderItem = true; } } @@ -50,7 +51,7 @@ public List getRecipes() { } @Override - public CachedCircleRecipe getCachedRecipe(RecipePetals recipe) { + public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe); } From 63c2b392070e3bdd498608471e0f557f81eedbb4 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Sat, 21 Mar 2026 01:53:49 -0400 Subject: [PATCH 13/32] Fix server crash --- .../vazkii/botania/client/integration/nei/IMCForNEI.java | 8 +++----- src/main/java/vazkii/botania/common/Botania.java | 2 ++ .../vazkii/botania/common/core/proxy/CommonProxy.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java index f6699d7c67..ebdae9c33a 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java +++ b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java @@ -2,14 +2,12 @@ import cpw.mods.fml.common.event.FMLInterModComms; import net.minecraft.nbt.NBTTagCompound; -import vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery; public class IMCForNEI { public static void IMCSender() { - String brewery = new RecipeHandlerBrewery().getOverlayIdentifier(); - sendCatalyst(brewery, "Botania:vial", -1); - sendCatalyst(brewery, "Botania:vial:1", -1); - sendCatalyst(brewery, "Botania:incenseStick", -1); + sendCatalyst("botania.brewery", "Botania:vial", -1); + sendCatalyst("botania.brewery", "Botania:vial:1", -1); + sendCatalyst("botania.brewery", "Botania:incenseStick", -1); } private static void sendCatalyst(String handlerName, String stack, int priority) { diff --git a/src/main/java/vazkii/botania/common/Botania.java b/src/main/java/vazkii/botania/common/Botania.java index d6b8844dd1..892abdeb71 100644 --- a/src/main/java/vazkii/botania/common/Botania.java +++ b/src/main/java/vazkii/botania/common/Botania.java @@ -43,6 +43,7 @@ public class Botania { public static boolean etFuturumLoaded = false; public static boolean storageDrawersLoaded = false; public static boolean structureLibLoaded = false; + public static boolean neiLoaded = false; public static ILightHelper lightHelper; @@ -63,6 +64,7 @@ public void preInit(FMLPreInitializationEvent event) { etFuturumLoaded = Loader.isModLoaded("etfuturum"); storageDrawersLoaded = Loader.isModLoaded("StorageDrawers"); structureLibLoaded = Loader.isModLoaded("structurelib"); + neiLoaded = Loader.isModLoaded("NotEnoughItems"); lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla(); proxy.preInit(event); diff --git a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java index 19f743fee4..c0bdab82f7 100644 --- a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java @@ -155,7 +155,7 @@ public void init(FMLInitializationEvent event) { LexiconData.init(); - if (Loader.isModLoaded("NotEnoughItems")) { + if (Botania.neiLoaded) { IMCForNEI.IMCSender(); } } From 96f3f498fb5fc9e4327b4a328e5ae25b829c124d Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Thu, 28 May 2026 12:36:58 -0400 Subject: [PATCH 14/32] Clean brewery handler --- .../client/integration/nei/IMCForNEI.java | 8 +++--- .../nei/recipe/RecipeHandlerBrewery.java | 25 ++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java index ebdae9c33a..8f3a60b83f 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java +++ b/src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java @@ -2,12 +2,14 @@ import cpw.mods.fml.common.event.FMLInterModComms; import net.minecraft.nbt.NBTTagCompound; +import vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery; public class IMCForNEI { public static void IMCSender() { - sendCatalyst("botania.brewery", "Botania:vial", -1); - sendCatalyst("botania.brewery", "Botania:vial:1", -1); - sendCatalyst("botania.brewery", "Botania:incenseStick", -1); + sendCatalyst(RecipeHandlerBrewery.OVERLAY, "Botania:vial", -1); + sendCatalyst(RecipeHandlerBrewery.OVERLAY, "Botania:vial:1", -1); + sendCatalyst(RecipeHandlerBrewery.OVERLAY, "Botania:incenseStick", -1); + sendCatalyst(RecipeHandlerBrewery.OVERLAY, "Botania:bloodPendant", -1); } private static void sendCatalyst(String handlerName, String stack, int priority) { diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index e94c32364a..971b7d7d4a 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -23,6 +23,8 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler { + public static final String OVERLAY = "botania.brewery"; + public class CachedBreweryRecipe extends CachedRecipe { public List inputs = new ArrayList<>(); @@ -38,8 +40,8 @@ public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) { toVial = new ItemStack(ModItems.vial); } else { toVial = vial.copy(); + toVial.stackSize = 1; } - toVial.stackSize = 1; inputs.add(new PositionedStack(toVial, 39, 42)); output = new PositionedStack(recipe.getOutput(toVial), 87, 42); @@ -52,14 +54,13 @@ public CachedBreweryRecipe(RecipeBrew recipe) { public void setIngredients(List inputs) { int left = 96 - inputs.size() * 18 / 2; - int i = 0; - for (Object o : inputs) { - if (o instanceof String) { - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6)); + for (int i = 0; i < inputs.size(); i++) { + Object o = inputs.get(i); + if (o instanceof String oredict) { + this.inputs.add(new PositionedStack(OreDictionary.getOres(oredict), left + i * 18, 6)); } else { this.inputs.add(new PositionedStack(o, left + i * 18, 6)); } - i++; } } @@ -82,7 +83,7 @@ public String getRecipeName() { @Override public String getOverlayIdentifier() { - return "botania.brewery"; + return OVERLAY; } @Override @@ -115,11 +116,9 @@ public void loadCraftingRecipes(String outputId, Object... results) { @Override public void loadCraftingRecipes(ItemStack result) { - if (!(result.getItem() instanceof IBrewItem)) { - return; - } + if (!(result.getItem() instanceof IBrewItem brew)) return; for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { - if (recipe != null && ((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew()) { + if (recipe != null && brew.getBrew(result) == recipe.getBrew()) { arecipes.add(new CachedBreweryRecipe(recipe)); } } @@ -135,9 +134,7 @@ public void loadUsageRecipes(ItemStack ingredient) { } } else { for (RecipeBrew recipe : BotaniaAPI.brewRecipes) { - if (recipe == null) - continue; - + if (recipe == null) continue; CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe); if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient)) { arecipes.add(crecipe); From f164e3843d8d89d4e63996298e627b623e266aaf Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Thu, 28 May 2026 15:01:28 -0400 Subject: [PATCH 15/32] Use jvmdg and fix tiara easter egg. JAXB was removed from the standard jdk and using SecureRandom before comparing against a static hash was broken. I needed to make a new solution for it, see the comment on onEquipped. --- gradle.properties | 2 +- .../equipment/bauble/ItemFlightTiara.java | 58 ++++++++++--------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0db9f98626..6312d64f06 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,7 +44,7 @@ developmentEnvironmentUserName = Developer # - jabel: Jabel syntax-only support, compiles to J8 bytecode # - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs) # - modern: Native modern Java bytecode, no downgrading -enableModernJavaSyntax = jabel +enableModernJavaSyntax = jvmDowngrader # If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues, # and should *not* be used in most situations. -1 disables this. diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index a81027f49a..bd31d3d90d 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -10,14 +10,13 @@ */ package vazkii.botania.common.item.equipment.bauble; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; import java.util.ArrayList; +import java.util.HexFormat; import java.util.List; -import javax.xml.bind.annotation.adapters.HexBinaryAdapter; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; @@ -121,44 +120,47 @@ public void addHiddenTooltip(ItemStack stack, EntityPlayer player, List infoList.add(StatCollector.translateToLocal("botania.wings" + stack.getItemDamage())); } + /** + * The original solution for "16E1BDFD1D6AE1A954C9C5E1B2D9099780F3E1724541F1F2F77310B769CFFBAC" has been lost + * to time. It's supposed to be a 19 character long Matrix reference, but hash() is broken and gives + * inconsistent output, so it probably wouldn't even be recognized if you got it right. It was later + * replaced with the name of an Aqours single, but the name is too long for anvils in 1.7.10. + * It has been fixed to be consistent (and considerably simplified since doing weird random obfuscation before + * hashing is pointless at best), but it required replacing it with my own solution. + * If you have the original solution, I will gladly replace this one with it. + * Here are a few hints: + * It's the title of a song that aligns with Vazkii's interests. + * For authenticity, this song was released before this secret was originally added (2015). + * This song has a special segment only present in one of the single-member versions. + * -koolkrafter5 + */ @Override public void onEquipped(ItemStack stack, EntityLivingBase player) { super.onEquipped(stack, player); - if(stack.getItemDamage() != WING_TYPES && hash(stack.getDisplayName()).equals("16E1BDFD1D6AE1A954C9C5E1B2D9099780F3E1724541F1F2F77310B769CFFBAC")) { + if(stack.getItemDamage() != WING_TYPES && hash(stack.getDisplayName()).equals("04E789FA6BC538F7645606141A1CFECECF4E84C301CB892779E761FD3FFF6386")) { stack.setItemDamage(WING_TYPES); stack.getTagCompound().removeTag("display"); } } String hash(String str) { - if(str != null) - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - return new HexBinaryAdapter().marshal(md.digest(salt(str).getBytes())); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return ""; + if (str == null) { + return ""; + } + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + byte[] digest = md.digest(salt(str).getBytes(StandardCharsets.UTF_8)); + return HexFormat.of().withUpperCase().formatHex(digest); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + return ""; + } } // Might as well be called sugar given it's not secure at all :D String salt(String str) { - str = str += "wowsuchsaltmuchsecurityverywow"; - SecureRandom rand = new SecureRandom(str.getBytes()); - int l = str.length(); - int steps = rand.nextInt(l); - char[] chrs = str.toCharArray(); - for(int i = 0; i < steps; i++) { - int indA = rand.nextInt(l); - int indB; - do { - indB = rand.nextInt(l); - } while(indB == indA); - char c = (char) (chrs[indA] ^ chrs[indB]); - chrs[indA] = c; - } - - return String.copyValueOf(chrs); + return str + "wowsuchsaltmuchsecurityverywow"; } @Override From a1a073d24f0d34247300dce96744fa178bcb0096 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Thu, 28 May 2026 15:05:50 -0400 Subject: [PATCH 16/32] Clean elven trade handler --- .../nei/recipe/RecipeHandlerElvenTrade.java | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index a44d078446..1dda46bf73 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -5,6 +5,8 @@ import java.util.Arrays; import java.util.List; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; @@ -25,29 +27,27 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler { + public static final String OVERLAY = "botania.elvenTrade"; + public class CachedElvenTradeRecipe extends CachedRecipe { public List inputs = new ArrayList<>(); public PositionedStack output; public CachedElvenTradeRecipe(RecipeElvenTrade recipe) { - if (recipe == null) - return; - + if (recipe == null) return; setIngredients(recipe.getInputs()); output = new PositionedStack(recipe.getOutput(), 107, 46); } public void setIngredients(List inputs) { - int i = 0; - for (Object o : inputs) { - if (o instanceof String) { - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6)); + for (int i = 0; i < inputs.size(); i++) { + Object o = inputs.get(i); + if (o instanceof String oreName) { + this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), 60 + i * 18, 6)); } else { this.inputs.add(new PositionedStack(o, 60 + i * 18, 6)); } - - i++; } } @@ -60,7 +60,6 @@ public List getIngredients() { public PositionedStack getResult() { return output; } - } @Override @@ -70,7 +69,7 @@ public String getRecipeName() { @Override public String getOverlayIdentifier() { - return "botania.elvenTrade"; + return OVERLAY; } @Override @@ -126,27 +125,27 @@ public void loadUsageRecipes(ItemStack ingredient) { } private List filteredElvenTradeRecipes() { - List result = new ArrayList<>(); - - for (RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) { - if (recipe == null) { - continue; - } - - // Don't show dummy recipes where input and output are the same - if (recipe.getInputs().size() != 1 || !stackSame(recipe.getOutput(), recipe.getInputs().get(0))) { - result.add(recipe); - } - } - - return result; + return Lists.newArrayList( + Iterables.filter( + BotaniaAPI.elvenTradeRecipes, + recipe -> recipe != null + && (recipe.getInputs().size() != 1 + || !stackSame(recipe.getOutput(), recipe.getInputs().getFirst())) + ) + ); } private boolean stackSame(ItemStack stack, Object obj) { - if (obj instanceof String) { - return OreDictionary.getOres((String) obj).stream().anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); + if (obj instanceof String oreName) { + return Iterables.any( + OreDictionary.getOres(oreName), + s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s) + ); } else { - return Arrays.stream(NEIServerUtils.extractRecipeItems(obj)).anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)); + return Iterables.any( + Arrays.asList(NEIServerUtils.extractRecipeItems(obj)), + s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s) + ); } } From 461bed92359738f3aafeb6546187b1eadcf3e667 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:12:09 -0400 Subject: [PATCH 17/32] Fix name for consistency --- .../client/integration/nei/recipe/RecipeHandlerBrewery.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index 971b7d7d4a..339faa467d 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -56,8 +56,8 @@ public void setIngredients(List inputs) { for (int i = 0; i < inputs.size(); i++) { Object o = inputs.get(i); - if (o instanceof String oredict) { - this.inputs.add(new PositionedStack(OreDictionary.getOres(oredict), left + i * 18, 6)); + if (o instanceof String oreName) { + this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), left + i * 18, 6)); } else { this.inputs.add(new PositionedStack(o, left + i * 18, 6)); } From 3848b29049c1462b45054c35bf988bb8accc3d8a Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:13:07 -0400 Subject: [PATCH 18/32] Narrow regex --- .../integration/nei/recipe/RecipeHandlerLexicaBotania.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index 6a16b19908..920de993d7 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -94,7 +94,7 @@ public void drawBackground(int recipe) { KnowledgeType type = recipeObj.entry.getKnowledgeType(); GuiDraw.drawStringC( - type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&.", ""), + type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&[0-9a-fklmnor]", ""), 82, 42, 0x404040, From 2be7ea42a8d21bcd88b2fdf7e308e4c344de4ba1 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:23:38 -0400 Subject: [PATCH 19/32] Cache these catalysts and rename other cached item stacks --- .../nei/recipe/RecipeHandlerLexicaBotania.java | 4 ++-- .../integration/nei/recipe/RecipeHandlerManaPool.java | 10 ++++++---- .../nei/recipe/RecipeHandlerPetalApothecary.java | 4 ++-- .../integration/nei/recipe/RecipeHandlerPureDaisy.java | 4 ++-- .../nei/recipe/RecipeHandlerRunicAltar.java | 7 ++++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java index 920de993d7..c744edf5c2 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerLexicaBotania.java @@ -33,7 +33,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler; public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler { - private static final ItemStack lexicaStack = new ItemStack(ModItems.lexicon); + private static final ItemStack LEXICA = new ItemStack(ModItems.lexicon); public class CachedLexicaBotaniaRecipe extends CachedRecipe { @@ -83,7 +83,7 @@ public void drawBackground(int recipe) { CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe)); - NEIHelper.renderItemIntoGUI(lexicaStack, 51, 5); + NEIHelper.renderItemIntoGUI(LEXICA, 51, 5); GuiDraw.drawStringC( EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()), diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 8857a8f32f..97605b1130 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -25,10 +25,12 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler { - private static final ItemStack poolStack = new ItemStack(ModBlocks.pool); + private static final ItemStack POOL = new ItemStack(ModBlocks.pool); public class CachedManaPoolRecipe extends CachedRecipe { + private static final PositionedStack ALCHEMY = new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37); + private static final PositionedStack CONJURATION = new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37); public PositionedStack input; public PositionedStack output; public PositionedStack catalyst; @@ -44,9 +46,9 @@ public CachedManaPoolRecipe(RecipeManaInfusion recipe) { } if (recipe.isAlchemy()) { - catalyst = new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37); + catalyst = ALCHEMY; } else if (recipe.isConjuration()) { - catalyst = new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37); + catalyst = CONJURATION; } output = new PositionedStack(recipe.getOutput(), 101, 37); @@ -115,7 +117,7 @@ public void drawBackground(int recipe) { RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderTilePool.forceMana = true; - NEIHelper.renderItemIntoGUI(poolStack, 71, 37); + NEIHelper.renderItemIntoGUI(POOL, 71, 37); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderHelper.disableStandardItemLighting(); } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 08559cd96c..a67ba0dfdb 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -24,7 +24,7 @@ import vazkii.botania.common.core.helper.ItemNBTHelper; public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { - private static final ItemStack altarStack = new ItemStack(ModBlocks.altar); + private static final ItemStack APOTHECARY = new ItemStack(ModBlocks.altar); public class CachedPetalApothecaryRecipe extends CachedRecipe { public List inputs = new ArrayList<>(); @@ -118,7 +118,7 @@ public void drawBackground(int recipe) { } protected ItemStack getRenderItem() { - return altarStack; + return APOTHECARY; } public List getRecipes() { diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index 8b0fc8bf72..0b8047c6b8 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -24,7 +24,7 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { - private static final ItemStack flowerStack = ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY); + private static final ItemStack DAISY = ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY); public class CachedPureDaisyRecipe extends CachedRecipe { @@ -90,7 +90,7 @@ public void drawBackground(int recipe) { GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY); GuiDraw.drawTexturedModalRect(48, 10, 0, 0, 65, 44); // Flower item - NEIHelper.renderItemIntoGUI(flowerStack, 71, 23); + NEIHelper.renderItemIntoGUI(DAISY, 71, 23); } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java index 598029d24b..4d72ad963a 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java @@ -14,7 +14,8 @@ public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary { - private static final ItemStack altarStack = new ItemStack(ModBlocks.runeAltar); + private static final ItemStack ALTAR = new ItemStack(ModBlocks.runeAltar); + private static final PositionedStack LIVINGROCK = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39); public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe { @@ -52,12 +53,12 @@ public List getRecipes() { @Override public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { - return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe); + return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe, LIVINGROCK); } @Override protected ItemStack getRenderItem() { - return altarStack; + return ALTAR; } } From b82655ed64d5ade1afe80ec841fc4c55aaba5d38 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:23:56 -0400 Subject: [PATCH 20/32] Fix name for renderItemIntoGUI param --- .../java/vazkii/botania/client/integration/nei/NEIHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java index 4432d9464c..35fd265078 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java +++ b/src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java @@ -12,7 +12,7 @@ public class NEIHelper { public static final TextureManager textureManager = mc.getTextureManager(); public static final FontRenderer font = mc.fontRenderer; - public static void renderItemIntoGUI(ItemStack flowerStack, int x, int y) { - renderItem.renderItemIntoGUI(font, textureManager, flowerStack, x, y); + public static void renderItemIntoGUI(ItemStack stack, int x, int y) { + renderItem.renderItemIntoGUI(font, textureManager, stack, x, y); } } From 5e59b54f97c922c4e2660dd59d7730a2ef00a9e0 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:24:06 -0400 Subject: [PATCH 21/32] Remove unused import --- src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java index c0bdab82f7..23af5f918c 100644 --- a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java @@ -85,7 +85,6 @@ import vazkii.botania.common.world.WorldTypeSkyblock; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; From c1bac66d2a8ddcc5e768dc66f89f837393838656 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:24:36 -0400 Subject: [PATCH 22/32] Use positionedStackContainsWithNBT --- .../client/integration/nei/recipe/RecipeHandlerManaPool.java | 3 ++- .../java/vazkii/botania/common/core/helper/ItemNBTHelper.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 97605b1130..b2dc38c204 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -152,7 +152,8 @@ public void loadUsageRecipes(ItemStack ingredient) { if (recipe == null) continue; CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe); - if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) { + if ((ItemNBTHelper.positionedStackContainsWithNBT(crecipe.input, ingredient)) || + (ItemNBTHelper.positionedStackContainsWithNBT(crecipe.catalyst, ingredient))) { arecipes.add(crecipe); } } diff --git a/src/main/java/vazkii/botania/common/core/helper/ItemNBTHelper.java b/src/main/java/vazkii/botania/common/core/helper/ItemNBTHelper.java index b0d64059c1..16a8ffb5e3 100644 --- a/src/main/java/vazkii/botania/common/core/helper/ItemNBTHelper.java +++ b/src/main/java/vazkii/botania/common/core/helper/ItemNBTHelper.java @@ -22,7 +22,6 @@ import javax.annotation.Nullable; import java.util.Collection; -import java.util.Set; public final class ItemNBTHelper { @@ -221,6 +220,7 @@ private static NBTBase get(NBTTagList tag, int idx) * NBT-friendly version of {@link codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe#contains(Collection, ItemStack)} */ public static boolean cachedRecipeContainsWithNBT(Collection ingredients, ItemStack ingredient) { + if (ingredients == null) return false; for (PositionedStack stack : ingredients) if (positionedStackContainsWithNBT(stack, ingredient)) return true; @@ -232,6 +232,7 @@ public static boolean cachedRecipeContainsWithNBT(Collection in * NBT-friendly version of {@link codechicken.nei.PositionedStack#contains(ItemStack)} */ public static boolean positionedStackContainsWithNBT(PositionedStack stack, ItemStack ingredient) { + if (stack == null) return false; for(ItemStack item : stack.items) if(areStacksSameTypeCraftingWithNBT(item, ingredient)) return true; From 33490aa26671614f3a51a5303440b87e4d25bbf9 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:41:02 -0400 Subject: [PATCH 23/32] Modify pure daisy to single ingredient and remove unused otherStacks --- .../nei/recipe/RecipeHandlerPureDaisy.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index 0b8047c6b8..3537b91766 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -1,8 +1,6 @@ package vazkii.botania.client.integration.nei.recipe; import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -28,24 +26,23 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler { public class CachedPureDaisyRecipe extends CachedRecipe { - public List inputs = new ArrayList<>(); + public PositionedStack inputs; public PositionedStack output; - public List otherStacks = new ArrayList<>(); public CachedPureDaisyRecipe(RecipePureDaisy recipe) { if (recipe == null) return; - if (recipe.getInput() instanceof String) { - inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23)); + if (recipe.getInput() instanceof String oreName) { + inputs = new PositionedStack(OreDictionary.getOres(oreName), 42, 23); } else { - inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23)); + inputs = new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23); } output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23); } @Override - public List getIngredients() { + public PositionedStack getIngredient() { return inputs; } @@ -54,11 +51,6 @@ public PositionedStack getResult() { return output; } - @Override - public List getOtherStacks() { - return otherStacks; - } - } @Override From 87bad3655076a0f92f62969c2424c525246c76a4 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:41:36 -0400 Subject: [PATCH 24/32] Clean up apothecary and runic handler center items --- .../recipe/RecipeHandlerPetalApothecary.java | 21 ++++++++----------- .../nei/recipe/RecipeHandlerRunicAltar.java | 7 ++----- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index a67ba0dfdb..3226033300 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -29,21 +29,17 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler { public class CachedPetalApothecaryRecipe extends CachedRecipe { public List inputs = new ArrayList<>(); public PositionedStack output; - public boolean renderItem; - public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) { + public CachedPetalApothecaryRecipe(RecipePetals recipe, PositionedStack centerItem) { setIngredients(recipe.getInputs()); output = new PositionedStack(recipe.getOutput(), 111, 21); - renderItem = addCenterItem; - if (addCenterItem) { - ItemStack seedStack = new ItemStack(Items.wheat_seeds); - seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed")); - inputs.add(new PositionedStack(seedStack, 73, 39)); + if (centerItem != null) { + inputs.add(centerItem); } } public CachedPetalApothecaryRecipe(RecipePetals recipe) { - this(recipe, true); + this(recipe, null); } public void setIngredients(List inputs) { @@ -54,8 +50,8 @@ public void setIngredients(List inputs) { int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32); int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32); - if (o instanceof String) { - this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY)); + if (o instanceof String oreName) { + this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), posX, posY)); } else { this.inputs.add(new PositionedStack(o, posX, posY)); } @@ -109,7 +105,6 @@ public void drawBackground(int recipe) { GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY); GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92); // Item - if (!((CachedPetalApothecaryRecipe) arecipes.get(recipe)).renderItem) return; RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); NEIHelper.renderItemIntoGUI(getRenderItem(), 73, 55); @@ -126,7 +121,9 @@ public List getRecipes() { } public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) { - return new CachedPetalApothecaryRecipe(recipe, true); + ItemStack seedStack = new ItemStack(Items.wheat_seeds); + seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed")); + return new CachedPetalApothecaryRecipe(recipe, new PositionedStack(seedStack, 73, 39)); } @Override diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java index 4d72ad963a..b38e9667a7 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerRunicAltar.java @@ -20,13 +20,10 @@ public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary { public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe { public int manaUsage; - private static final PositionedStack livingrock = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39); - public CachedRunicAltarRecipe(RecipeRuneAltar recipe) { - super(recipe, false); - inputs.add(livingrock); + public CachedRunicAltarRecipe(RecipeRuneAltar recipe, PositionedStack centerItem) { + super(recipe, centerItem); manaUsage = recipe.getManaUsage(); - renderItem = true; } } From 5863743e319c7f887795c3a0aff4ad7cce8cdd80 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Fri, 29 May 2026 20:59:10 -0400 Subject: [PATCH 25/32] Use reassignments when making these PositionedStacks --- .../integration/nei/recipe/RecipeHandlerBrewery.java | 5 ++--- .../integration/nei/recipe/RecipeHandlerElvenTrade.java | 5 ++--- .../integration/nei/recipe/RecipeHandlerManaPool.java | 8 ++++---- .../nei/recipe/RecipeHandlerPetalApothecary.java | 5 ++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java index 339faa467d..39f2d29f60 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerBrewery.java @@ -57,10 +57,9 @@ public void setIngredients(List inputs) { for (int i = 0; i < inputs.size(); i++) { Object o = inputs.get(i); if (o instanceof String oreName) { - this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), left + i * 18, 6)); - } else { - this.inputs.add(new PositionedStack(o, left + i * 18, 6)); + o = OreDictionary.getOres(oreName); } + this.inputs.add(new PositionedStack(o, left + i * 18, 6)); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 1dda46bf73..5fc3139fc2 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -44,10 +44,9 @@ public void setIngredients(List inputs) { for (int i = 0; i < inputs.size(); i++) { Object o = inputs.get(i); if (o instanceof String oreName) { - this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), 60 + i * 18, 6)); - } else { - this.inputs.add(new PositionedStack(o, 60 + i * 18, 6)); + o = OreDictionary.getOres(oreName); } + this.inputs.add(new PositionedStack(o, 60 + i * 18, 6)); } } diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index b2dc38c204..64a307cd35 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -39,11 +39,11 @@ public class CachedManaPoolRecipe extends CachedRecipe { public CachedManaPoolRecipe(RecipeManaInfusion recipe) { if (recipe == null) return; - if (recipe.getInput() instanceof String) { - input = new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37); - } else { - input = new PositionedStack(recipe.getInput(), 42, 37); + Object o = recipe.getInput(); + if (o instanceof String oreName) { + o = OreDictionary.getOres(oreName); } + input = new PositionedStack(o, 42, 37); if (recipe.isAlchemy()) { catalyst = ALCHEMY; diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 3226033300..a1120b0008 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -51,10 +51,9 @@ public void setIngredients(List inputs) { int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32); if (o instanceof String oreName) { - this.inputs.add(new PositionedStack(OreDictionary.getOres(oreName), posX, posY)); - } else { - this.inputs.add(new PositionedStack(o, posX, posY)); + o = OreDictionary.getOres(oreName); } + this.inputs.add(new PositionedStack(o, posX, posY)); currentDegree += degreePerInput; } } From f2fd81e78d89b9d760d3df2d9b0ce44171f8cb57 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 17:49:14 -0400 Subject: [PATCH 26/32] Remove redundant null check --- .../common/item/equipment/bauble/ItemFlightTiara.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index bd31d3d90d..aa519460d9 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -137,17 +137,14 @@ public void addHiddenTooltip(ItemStack stack, EntityPlayer player, List @Override public void onEquipped(ItemStack stack, EntityLivingBase player) { super.onEquipped(stack, player); - if(stack.getItemDamage() != WING_TYPES && hash(stack.getDisplayName()).equals("04E789FA6BC538F7645606141A1CFECECF4E84C301CB892779E761FD3FFF6386")) { + if (stack.getItemDamage() != WING_TYPES && + hash(stack.getDisplayName()).equals("04E789FA6BC538F7645606141A1CFECECF4E84C301CB892779E761FD3FFF6386")) { stack.setItemDamage(WING_TYPES); stack.getTagCompound().removeTag("display"); } } String hash(String str) { - if (str == null) { - return ""; - } - try { MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] digest = md.digest(salt(str).getBytes(StandardCharsets.UTF_8)); From 6bef147998862665da65e90ddb267e59a13438d2 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 17:52:40 -0400 Subject: [PATCH 27/32] Configure jvmdg to use gtnhlib stubs --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6312d64f06..3fc1eed63d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -65,7 +65,7 @@ enableModernJavaSyntax = jvmDowngrader # - external: Another dependency provides stubs (no constraint, no warning) # - (empty): Warning reminding you to configure stubs # Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md -# jvmDowngraderStubsProvider = +jvmDowngraderStubsProvider = gtnhlib # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. From 48b03707bb0a952b53bde13da8a2cafef1b81e8e Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 17:52:52 -0400 Subject: [PATCH 28/32] Remove extra parens --- .../client/integration/nei/recipe/RecipeHandlerManaPool.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java index 64a307cd35..ee6e880343 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerManaPool.java @@ -152,8 +152,8 @@ public void loadUsageRecipes(ItemStack ingredient) { if (recipe == null) continue; CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe); - if ((ItemNBTHelper.positionedStackContainsWithNBT(crecipe.input, ingredient)) || - (ItemNBTHelper.positionedStackContainsWithNBT(crecipe.catalyst, ingredient))) { + if (ItemNBTHelper.positionedStackContainsWithNBT(crecipe.input, ingredient) || + ItemNBTHelper.positionedStackContainsWithNBT(crecipe.catalyst, ingredient)) { arecipes.add(crecipe); } } From afa5ba13a2598a85a3f4068618050896c23b3bc4 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 17:56:39 -0400 Subject: [PATCH 29/32] Use constructors intelligently --- .../nei/recipe/RecipeHandlerPetalApothecary.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index a1120b0008..3029d1ac0e 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -31,15 +31,13 @@ public class CachedPetalApothecaryRecipe extends CachedRecipe { public PositionedStack output; public CachedPetalApothecaryRecipe(RecipePetals recipe, PositionedStack centerItem) { - setIngredients(recipe.getInputs()); - output = new PositionedStack(recipe.getOutput(), 111, 21); - if (centerItem != null) { - inputs.add(centerItem); - } + this(recipe); + inputs.add(centerItem); } public CachedPetalApothecaryRecipe(RecipePetals recipe) { - this(recipe, null); + setIngredients(recipe.getInputs()); + output = new PositionedStack(recipe.getOutput(), 111, 21); } public void setIngredients(List inputs) { From d9940264f5efc53a625aa7429fce7d06dd445996 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 17:57:56 -0400 Subject: [PATCH 30/32] Remove reference to getRecipeID --- .../integration/nei/recipe/RecipeHandlerPetalApothecary.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java index 3029d1ac0e..41361936bc 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPetalApothecary.java @@ -74,10 +74,10 @@ public String getRecipeName() { @Override public String getOverlayIdentifier() { - return getRecipeID(); + return "botania.petalApothecary"; } - // Used by the Alfheim addon + // Used by the Alfheim addon, identical to getOverlayIdentifier() @Deprecated public String getRecipeID() { return "botania.petalApothecary"; From dc0ecf382b99b2d100bdf18fe4c2b4d877b75bd9 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 18:05:30 -0400 Subject: [PATCH 31/32] Use reassignmnent here too --- .../integration/nei/recipe/RecipeHandlerPureDaisy.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java index 3537b91766..33aad79e3b 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerPureDaisy.java @@ -32,12 +32,13 @@ public class CachedPureDaisyRecipe extends CachedRecipe { public CachedPureDaisyRecipe(RecipePureDaisy recipe) { if (recipe == null) return; - if (recipe.getInput() instanceof String oreName) { - inputs = new PositionedStack(OreDictionary.getOres(oreName), 42, 23); + Object o = recipe.getInput(); + if (o instanceof String oreName) { + o = OreDictionary.getOres(oreName); } else { - inputs = new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23); + o = new ItemStack((Block) o); } - + inputs = new PositionedStack(o, 42, 23); output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23); } From 9e1e20cd4244ebf744906a15fcba033312818ebe Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Tue, 2 Jun 2026 18:11:18 -0400 Subject: [PATCH 32/32] Directly return the Iterable --- .../nei/recipe/RecipeHandlerElvenTrade.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java index 5fc3139fc2..0940bb6115 100644 --- a/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java +++ b/src/main/java/vazkii/botania/client/integration/nei/recipe/RecipeHandlerElvenTrade.java @@ -6,7 +6,6 @@ import java.util.List; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; @@ -123,15 +122,12 @@ public void loadUsageRecipes(ItemStack ingredient) { } } - private List filteredElvenTradeRecipes() { - return Lists.newArrayList( - Iterables.filter( - BotaniaAPI.elvenTradeRecipes, - recipe -> recipe != null - && (recipe.getInputs().size() != 1 - || !stackSame(recipe.getOutput(), recipe.getInputs().getFirst())) - ) - ); + private Iterable filteredElvenTradeRecipes() { + return Iterables.filter( + BotaniaAPI.elvenTradeRecipes, + recipe -> recipe != null + && (recipe.getInputs().size() != 1 + || !stackSame(recipe.getOutput(), recipe.getInputs().getFirst()))); } private boolean stackSame(ItemStack stack, Object obj) {