Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8615546
Remove deprecated getCycledIngredients
koolkrafter5 Mar 20, 2026
f180c95
Remove commented out pointless elven knowledge check
koolkrafter5 Mar 20, 2026
e8f70bb
Remove deprecated recipiesPerPage
koolkrafter5 Mar 20, 2026
b0429f7
Clean up brewery handler and show usable brew containers as catalysts
koolkrafter5 Mar 20, 2026
992a319
Clean up elven trade handler and replace stream with loop
koolkrafter5 Mar 20, 2026
aa7508a
Clean up floating flower handler and let it work with the inventory c…
koolkrafter5 Mar 20, 2026
95ef44f
Clean up lexica info handler, make the transfer rect actually work by…
koolkrafter5 Mar 20, 2026
9fca30d
Clean up mana pool handler and make the transfer rect actually work b…
koolkrafter5 Mar 20, 2026
64795d2
Move duplicate references to helper class and clean up string display
koolkrafter5 Mar 21, 2026
d8b9f5b
Clean up apothecary and runic altar handlers. Remove the altars from …
koolkrafter5 Mar 21, 2026
f5ec5fb
Clean up pure daisy handler. Add helper method to render items.
koolkrafter5 Mar 21, 2026
5656619
Fix crash with Alfheim mod by working around stupid decisions made a …
koolkrafter5 Mar 21, 2026
63c2b39
Fix server crash
koolkrafter5 Mar 21, 2026
96f3f49
Clean brewery handler
koolkrafter5 May 28, 2026
f164e38
Use jvmdg and fix tiara easter egg. JAXB was removed from the standar…
koolkrafter5 May 28, 2026
a1a073d
Clean elven trade handler
koolkrafter5 May 28, 2026
461bed9
Fix name for consistency
koolkrafter5 May 30, 2026
3848b29
Narrow regex
koolkrafter5 May 30, 2026
2be7ea4
Cache these catalysts and rename other cached item stacks
koolkrafter5 May 30, 2026
b82655e
Fix name for renderItemIntoGUI param
koolkrafter5 May 30, 2026
5e59b54
Remove unused import
koolkrafter5 May 30, 2026
c1bac66
Use positionedStackContainsWithNBT
koolkrafter5 May 30, 2026
33490aa
Modify pure daisy to single ingredient and remove unused otherStacks
koolkrafter5 May 30, 2026
87bad36
Clean up apothecary and runic handler center items
koolkrafter5 May 30, 2026
5863743
Use reassignments when making these PositionedStacks
koolkrafter5 May 30, 2026
f2fd81e
Remove redundant null check
koolkrafter5 Jun 2, 2026
6bef147
Configure jvmdg to use gtnhlib stubs
koolkrafter5 Jun 2, 2026
48b0370
Remove extra parens
koolkrafter5 Jun 2, 2026
afa5ba1
Use constructors intelligently
koolkrafter5 Jun 2, 2026
d994026
Remove reference to getRecipeID
koolkrafter5 Jun 2, 2026
dc0ecf3
Use reassignmnent here too
koolkrafter5 Jun 2, 2026
9e1e20c
Directly return the Iterable
koolkrafter5 Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -65,7 +65,7 @@ enableModernJavaSyntax = jabel
# - 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<E>, Map<K, V> types.
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/vazkii/botania/client/integration/nei/IMCForNEI.java
Original file line number Diff line number Diff line change
@@ -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() {
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) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("handlerID", handlerName);
nbt.setString("itemName", stack);
nbt.setInteger("priority", priority);
FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", nbt);
}
}
18 changes: 18 additions & 0 deletions src/main/java/vazkii/botania/client/integration/nei/NEIHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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;
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 stack, int x, int y) {
renderItem.renderItemIntoGUI(font, textureManager, stack, x, y);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,118 +23,123 @@

public class RecipeHandlerBrewery extends TemplateRecipeHandler {

public class CachedBreweryRecipe extends CachedRecipe {

public List<PositionedStack> 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<Object> 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<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, 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 static final String OVERLAY = "botania.brewery";

public class CachedBreweryRecipe extends CachedRecipe {

public List<PositionedStack> 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<Object> inputs) {
int left = 96 - inputs.size() * 18 / 2;

for (int i = 0; i < inputs.size(); i++) {
Object o = inputs.get(i);
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
}
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
}
}

@Override
public List<PositionedStack> getIngredients() {
return inputs;
}

@Override
public PositionedStack getResult() {
return output;
}

}

@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.brewery");
}

@Override
public String getOverlayIdentifier() {
return OVERLAY;
}

@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 brew)) return;
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if (recipe != null && brew.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);
}
}
}
}

}
Loading
Loading