Moved recipe inits to init, made the booklet JEI handler show all crafting options

This commit is contained in:
Ellpeck 2016-11-16 19:08:56 +01:00
parent 53f6ce0a24
commit 2ab8288282
7 changed files with 92 additions and 30 deletions

View file

@ -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);

View file

@ -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<ItemStack> list){
super.getItemStacksForPage(list);
list.add(this.outcome);
}
}

View file

@ -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);
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){
if(StackUtil.isValid(this.recipe.outputTwoStack)){
gui.addOrModifyItemRenderer(this.recipe.outputTwoStack, startX+38+30, startY+6+53, 1F, false);
}
}
}
@Override
public void getItemStacksForPage(List<ItemStack> list){
super.getItemStacksForPage(list);
if(this.recipe != null){
list.add(this.recipe.outputOneStack);
if(StackUtil.isValid(this.recipe.outputTwoStack)){
list.add(this.recipe.outputTwoStack);
}
}
}
}

View file

@ -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,6 +43,7 @@ public class PageEmpowerer extends BookletPage{
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
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);
@ -48,4 +52,14 @@ public class PageEmpowerer extends BookletPage{
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<ItemStack> list){
super.getItemStacksForPage(list);
if(this.recipe != null){
list.add(this.recipe.output);
}
}
}

View file

@ -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<ItemStack> list){
super.getItemStacksForPage(list);
list.add(this.output);
}
}

View file

@ -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);
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<ItemStack> list){
super.getItemStacksForPage(list);
if(this.recipe != null){
list.add(this.recipe.outputStack);
}
}
}

View file

@ -38,6 +38,7 @@ 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)){
if(!oresNoResult.contains(ore)){
oresNoResult.add(ore);
}
}
@ -45,6 +46,7 @@ public final class CrusherRecipeRegistry{
}
}
}
}
ArrayList<String> addedRecipes = new ArrayList<String>();
for(int i = recipeStartedAt; i < ActuallyAdditionsAPI.CRUSHER_RECIPES.size(); i++){