diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index d67e46d2b..d183c4c09 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -120,6 +120,15 @@ public class ActuallyAdditions{ InitCrafting.init(); InitEntities.init(); + InitVillager.init(); + ItemCoffee.initIngredients(); + CrusherCrafting.init(); + ItemCrafting.initMashedFoodRecipes(); + HairyBallHandler.init(); + TreasureChestHandler.init(); + LensRecipeHandler.init(); + EmpowererHandler.init(); + InitBooklet.init(); proxy.init(event); @@ -130,15 +139,6 @@ public class ActuallyAdditions{ public void postInit(FMLPostInitializationEvent event){ ModUtil.LOGGER.info("Starting PostInitialization Phase..."); - InitVillager.init(); - ItemCoffee.initIngredients(); - CrusherCrafting.init(); - ItemCrafting.initMashedFoodRecipes(); - HairyBallHandler.init(); - TreasureChestHandler.init(); - LensRecipeHandler.init(); - EmpowererHandler.init(); - InitBooklet.postInit(); proxy.postInit(event); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java index 499f2e095..975a4b133 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java @@ -19,13 +19,19 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; +import java.util.List; + public class PageCoffeeMachine extends BookletPage{ private final CoffeeIngredient ingredient; + private final ItemStack outcome; public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient){ super(localizationKey); this.ingredient = ingredient; + + this.outcome = new ItemStack(InitItems.itemCoffee); + ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient); } @Override @@ -46,12 +52,16 @@ public class PageCoffeeMachine extends BookletPage{ super.initGui(gui, startX, startY); gui.addOrModifyItemRenderer(this.ingredient.ingredient, startX+5+82, startY+10+1, 1F, true); - - ItemStack coffee = new ItemStack(InitItems.itemCoffee); - ActuallyAdditionsAPI.methodHandler.addEffectToStack(coffee, this.ingredient); - gui.addOrModifyItemRenderer(coffee, startX+5+36, startY+10+42, 1F, false); + gui.addOrModifyItemRenderer(this.outcome, startX+5+36, startY+10+42, 1F, false); gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX+5+37, startY+10+1, 1F, true); gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffee), startX+5+1, startY+10+1, 1F, true); } + + @Override + public void getItemStacksForPage(List list){ + super.getItemStacksForPage(list); + + list.add(this.outcome); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index b5df1b9e1..b22dc57be 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -13,8 +13,12 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; +import de.ellpeck.actuallyadditions.mod.util.StackUtil; +import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; +import java.util.List; + public class PageCrusherRecipe extends BookletPage{ private final CrusherRecipe recipe; @@ -40,11 +44,26 @@ public class PageCrusherRecipe extends BookletPage{ public void initGui(GuiBookletBase gui, int startX, int startY){ super.initGui(gui, startX, startY); - gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+38+18, startY+6+2, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.outputOneStack, startX+38+4, startY+6+53, 1F, false); + if(this.recipe != null){ + gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+38+18, startY+6+2, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.outputOneStack, startX+38+4, startY+6+53, 1F, false); - if(this.recipe.outputTwoStack != null){ - gui.addOrModifyItemRenderer(this.recipe.outputTwoStack, startX+38+30, startY+6+53, 1F, false); + if(StackUtil.isValid(this.recipe.outputTwoStack)){ + gui.addOrModifyItemRenderer(this.recipe.outputTwoStack, startX+38+30, startY+6+53, 1F, false); + } + } + } + + @Override + public void getItemStacksForPage(List list){ + super.getItemStacksForPage(list); + + if(this.recipe != null){ + list.add(this.recipe.outputOneStack); + + if(StackUtil.isValid(this.recipe.outputTwoStack)){ + list.add(this.recipe.outputTwoStack); + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java index a34e613ee..ae8dec79a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -13,8 +13,11 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; +import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; +import java.util.List; + public class PageEmpowerer extends BookletPage{ private final EmpowererRecipe recipe; @@ -40,12 +43,23 @@ public class PageEmpowerer extends BookletPage{ public void initGui(GuiBookletBase gui, int startX, int startY){ super.initGui(gui, startX, startY); - gui.addOrModifyItemRenderer(this.recipe.modifier1, startX+5+26, startY+10+1, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.modifier2, startX+5+1, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.modifier3, startX+5+51, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.modifier4, startX+5+26, startY+10+51, 1F, true); + if(this.recipe != null){ + gui.addOrModifyItemRenderer(this.recipe.modifier1, startX+5+26, startY+10+1, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.modifier2, startX+5+1, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.modifier3, startX+5+51, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.modifier4, startX+5+26, startY+10+51, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.input, startX+5+26, startY+10+26, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.output, startX+5+96, startY+10+26, 1F, false); + gui.addOrModifyItemRenderer(this.recipe.input, startX+5+26, startY+10+26, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.output, startX+5+96, startY+10+26, 1F, false); + } + } + + @Override + public void getItemStacksForPage(List list){ + super.getItemStacksForPage(list); + + if(this.recipe != null){ + list.add(this.recipe.output); + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index eaf98ef1e..a73dc1e13 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.fml.client.config.GuiUtils; +import java.util.List; import java.util.Map; public class PageFurnace extends BookletPage{ @@ -57,4 +58,11 @@ public class PageFurnace extends BookletPage{ } return null; } + + @Override + public void getItemStacksForPage(List list){ + super.getItemStacksForPage(list); + + list.add(this.output); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index 77e8fb5e3..53c7b0ff5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -10,16 +10,14 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; -import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; +import java.util.List; + public class PageReconstructor extends BookletPage{ private final LensConversionRecipe recipe; @@ -45,7 +43,18 @@ public class PageReconstructor extends BookletPage{ public void initGui(GuiBookletBase gui, int startX, int startY){ super.initGui(gui, startX, startY); - gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+30+1, startY+10+13, 1F, true); - gui.addOrModifyItemRenderer(this.recipe.outputStack, startX+30+47, startY+10+13, 1F, false); + if(this.recipe != null){ + gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+30+1, startY+10+13, 1F, true); + gui.addOrModifyItemRenderer(this.recipe.outputStack, startX+30+47, startY+10+13, 1F, false); + } + } + + @Override + public void getItemStacksForPage(List list){ + super.getItemStacksForPage(list); + + if(this.recipe != null){ + list.add(this.recipe.outputStack); + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java index f484d39d6..b25848c3e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/CrusherRecipeRegistry.java @@ -38,7 +38,9 @@ public final class CrusherRecipeRegistry{ String output = theCase.resultPreString+ore.substring(theCase.theCase.length()); if(!ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres(ore, false), OreDictionary.getOres(output, false), theCase.resultAmount, null, 0, 0)){ - oresNoResult.add(ore); + if(!oresNoResult.contains(ore)){ + oresNoResult.add(ore); + } } } }