From e5850ffb4ea632bcde07f7582b2fbf07ab8aff40 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 22 Nov 2015 22:17:42 +0100 Subject: [PATCH] Fixed some stuff regarding the Reconstructor --- .../booklet/page/PageReconstructor.java | 3 ++- .../actuallyadditions/items/ItemLens.java | 1 + .../nei/AtomicReconstructorRecipeHandler.java | 15 ++++++--------- .../recipe/ReconstructorRecipeHandler.java | 19 ++++++++++--------- .../assets/actuallyadditions/lang/en_US.lang | 1 + 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageReconstructor.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageReconstructor.java index ddd89deb7..478e55c24 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageReconstructor.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageReconstructor.java @@ -59,7 +59,8 @@ public class PageReconstructor extends BookletPage{ gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0); //Lens - strg = this.getRecipeForOutput(this.result).type.name; + ItemStack lens = this.getRecipeForOutput(this.result).type.lens; + strg = lens == null ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".noLens") : lens.getItem().getItemStackDisplayName(lens); gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+75, 0); } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java index 0128b9743..fbae0243c 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLens.java @@ -29,6 +29,7 @@ public class ItemLens extends Item implements IActAddItemOrBlock, IReconstructor public ItemLens(String name, ReconstructorRecipeHandler.LensType type){ this.name = name; this.type = type; + this.type.setLens(this); this.setMaxStackSize(1); } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/AtomicReconstructorRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/AtomicReconstructorRecipeHandler.java index 42d3a46c8..86ef81bbd 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/AtomicReconstructorRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/AtomicReconstructorRecipeHandler.java @@ -60,7 +60,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl if(outputId.equals(NAME) && getClass() == AtomicReconstructorRecipeHandler.class){ ArrayList recipes = ReconstructorRecipeHandler.recipes; for(ReconstructorRecipeHandler.Recipe recipe : recipes){ - arecipes.add(new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.name)); + arecipes.add(new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.lens)); } } else{ @@ -73,7 +73,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl ArrayList recipes = ReconstructorRecipeHandler.recipes; for(ReconstructorRecipeHandler.Recipe recipe : recipes){ if(ItemUtil.contains(OreDictionary.getOres(recipe.output, false), result, true)){ - arecipes.add(new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.name)); + arecipes.add(new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.lens)); } } } @@ -83,7 +83,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl ArrayList recipes = ReconstructorRecipeHandler.recipes; for(ReconstructorRecipeHandler.Recipe recipe : recipes){ if(ItemUtil.contains(OreDictionary.getOres(recipe.input, false), ingredient, true)){ - CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.name); + CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe.input, recipe.output, recipe.type.lens); theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient); arecipes.add(theRecipe); } @@ -119,10 +119,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl } CachedReconstructorRecipe cache = (CachedReconstructorRecipe)this.arecipes.get(recipe); - if(cache != null && cache.lens != null){ - GuiDraw.drawString(cache.lens, 10, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - } - + GuiDraw.drawString(cache.lens == null ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".noLens") : cache.lens.getItem().getItemStackDisplayName(cache.lens), 10, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } @Override @@ -134,9 +131,9 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl public PositionedStack result; public PositionedStack input; - public String lens; + public ItemStack lens; - public CachedReconstructorRecipe(String input, String result, String lens){ + public CachedReconstructorRecipe(String input, String result, ItemStack lens){ List outputs = OreDictionary.getOres(result, false); for(ItemStack ore : outputs){ ore.stackSize = 1; diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java index e4dddf988..86f6151cc 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java @@ -14,6 +14,7 @@ import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.Util; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -55,9 +56,9 @@ public class ReconstructorRecipeHandler{ //Colors for(int i = 0; i < TheColoredLampColors.values().length-1; i++){ - addRecipe("dye"+TheColoredLampColors.values()[i].name, "dye"+TheColoredLampColors.values()[i+1].name, 2000); + addRecipe("dye"+TheColoredLampColors.values()[i].name, "dye"+TheColoredLampColors.values()[i+1].name, 2000, LensType.COLOR); } - addRecipe("dye"+TheColoredLampColors.values()[15].name, "dye"+TheColoredLampColors.values()[0].name, 2000); + addRecipe("dye"+TheColoredLampColors.values()[15].name, "dye"+TheColoredLampColors.values()[0].name, 2000, LensType.COLOR); } } @@ -107,14 +108,10 @@ public class ReconstructorRecipeHandler{ public enum LensType{ - NONE("No Lens"), - COLOR("Color Lens"); + NONE, + COLOR; - public String name; - - LensType(String name){ - this.name = name; - } + public ItemStack lens; public float[] getColor(){ if(this == COLOR){ @@ -123,6 +120,10 @@ public class ReconstructorRecipeHandler{ } return new float[]{27F/255F, 109F/255F, 1F}; } + + public void setLens(Item lens){ + this.lens = new ItemStack(lens); + } } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index d21167ac4..bc64e3238 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -359,6 +359,7 @@ info.actuallyadditions.gui.the=the info.actuallyadditions.inputter.info.1=This is the first Slot in the connected Inventory to

at. info.actuallyadditions.inputter.info.2=This is the slot after the last Slot in the connected Inventory to

at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will

at Slot 2, 3, and 4. info.actuallyadditions.inputter.whitelistInfo=This applies for this part of the white-/blacklist. The other side applies as well, so you can have some Items whitelisted and some blacklisted. Note that, if you have an empty blacklist or an item whitelisted on at least one side, it will always go through. +info.actuallyadditions.noLens=No Lens #Container Names container.actuallyadditions.inputter.name=ESD