From 89477a0d12ed274b0a7d007ea32e6771553b0ca5 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 28 Oct 2014 10:24:19 -0400 Subject: [PATCH 1/2] Fix DS pressure plate recipes --- src/main/java/crazypants/enderio/item/ItemRecipes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/crazypants/enderio/item/ItemRecipes.java b/src/main/java/crazypants/enderio/item/ItemRecipes.java index e17318ab..067bd5bc 100644 --- a/src/main/java/crazypants/enderio/item/ItemRecipes.java +++ b/src/main/java/crazypants/enderio/item/ItemRecipes.java @@ -43,10 +43,10 @@ public class ItemRecipes { ItemStack dspp = new ItemStack(EnderIO.blockDarkSteelPressurePlate); - GameRegistry.addShapedRecipe(dspp, "ss ", 's', darkSteel); + GameRegistry.addShapedRecipe(dspp, "ss", 's', darkSteel); ItemStack dsppSilent = new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 1); - GameRegistry.addShapedRecipe(dsppSilent, " p ", " w ", 'p', dspp, 'w', Blocks.wool); + GameRegistry.addShapedRecipe(dsppSilent, "p", "w", 'p', dspp, 'w', Blocks.wool); //Soul Vessel GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(EnderIO.blockFusedQuartz,1,0)); From 3f6e9c21da22823385cd7e7fc6b37296b0554518 Mon Sep 17 00:00:00 2001 From: Tonius Date: Tue, 28 Oct 2014 17:04:48 +0100 Subject: [PATCH 2/2] Polished NEI handlers a bit. --- .../enderio/textures/gui/nei/alloySmelter.png | Bin 0 -> 2167 bytes .../enderio/textures/gui/nei/crusher.png | Bin 0 -> 1927 bytes .../nei/AlloySmelterRecipeHandler.java | 38 +++++---- .../enderio/nei/EnchanterRecipeHandler.java | 41 ++++++---- .../enderio/nei/NEIEnderIOConfig.java | 12 ++- .../enderio/nei/SagMillRecipeHandler.java | 76 ++++++------------ .../nei/SliceAndSpliceRecipeHandler.java | 19 ++++- .../enderio/nei/SoulBinderRecipeHandler.java | 73 +++++++++-------- .../enderio/nei/VatRecipeHandler.java | 56 +++---------- 9 files changed, 145 insertions(+), 170 deletions(-) create mode 100644 resources/assets/enderio/textures/gui/nei/alloySmelter.png create mode 100644 resources/assets/enderio/textures/gui/nei/crusher.png diff --git a/resources/assets/enderio/textures/gui/nei/alloySmelter.png b/resources/assets/enderio/textures/gui/nei/alloySmelter.png new file mode 100644 index 0000000000000000000000000000000000000000..f247298eafb535d9261a5241f6f05fbd5c1e700a GIT binary patch literal 2167 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5D>38$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&di49pAxJ|V6^adUI?8$Pc8w=w+xFW=qWeeBq=|Ns93#Ye$t2n_oWSgOwQ z2b60{g8YJk$$lgQhT!k)s=x^6EbxddW?K0k978JN-p=YRnr*;vY}=nH-|HWpYfyNpq090+ z?3-t~;}(mU9%!(4xfZ$>WjsydE3o&)Cls}83DdEeM8c0D@KxRoJ(PonXeZH&K}YYskV z%z~QTe?0%I-JiOA(*vh|yfwJZCedL0W=Z_o$^0rm47ko

e^ph)*&W6k zVS-w$GydPaY@7e(s?@Y9Q%X|G_aog_&6*ugTy>Go~_TVVP=V`39;tBVR z>hysYuV>d-J-f`DRU_VK_wU4QycK^1E26G0bANF7$6lb#d;Te&XgZc(Bb#6eR_@N^ zvsx>M>w^h|C)b!6eB%p;P49i~&AA7%%MUc=ziT)Qak0!1hBf7lj1mO`X}1}e3)-3` z8oufoFfj8S0taA$0P}`>tZWGf93kG}OJcaT`v3!v1;^%Ghouas|Fak#Y-k1=6~c8v x3S`2A2%d&yLx#Si3>IRe9Ad*@%J=W~S1n!Ue@;CJY&0-1c)I$ztaD0e0syBD*-QWc literal 0 HcmV?d00001 diff --git a/resources/assets/enderio/textures/gui/nei/crusher.png b/resources/assets/enderio/textures/gui/nei/crusher.png new file mode 100644 index 0000000000000000000000000000000000000000..66ea939d953a9696951ce197782b38f7ebfc707a GIT binary patch literal 1927 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP~67xiK_G|eZ}tX?qkP}{r~?TC_V~CLtxm4z&)lz^FbM3E{-7;ac^hc4!Z3ia^P0c@BjMC%9MIeFHL^*b&K1j?rFXU(oH+n z4?j8n*s@aY=ne+^`=1UlGynYhEv+wSPT%Wa|G1Sdd2?w8cD`{y&`80*Ch z_OV`L{dao%0p`Pd4>7;rp?hG}fiKLD->1hkyuBllplPsPvfe(O%c1e~q>tZ??GBU( zgv~E3Zt!k=-SzQ%@j8ZJMzNm#^Cz=LB>ee1N9DlXzkg+g`Ij-oB+6WNjHq>Ee0F%< zM%EuMj31ZwtM7SU&AOwJNn`;7Yr><0A`RL-30A+P%GwJig)^w{KXgyx+$XUIZ;apY zJTm#t;Aj8GtYF^k2Zqn>0~@j#uRTt<#VjG0pm!ik!Ka$xF|&UXD*np!4Q7Kfl;DnA;WL;?T5Co2QaML z(8y%)!-?@*eqL)P{{oXMG#y5t2 z0uSQBde(%)X1ua$ZAu?18_ Ndb;|#taD0e0stfiXeR&w literal 0 HcmV?d00001 diff --git a/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java b/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java index 0d4f5a23..12c4586f 100644 --- a/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java @@ -4,17 +4,17 @@ import java.awt.Rectangle; import java.util.ArrayList; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.machine.alloy.AlloyRecipeManager; import crazypants.enderio.machine.alloy.GuiAlloySmelter; -import crazypants.enderio.machine.alloy.VanillaSmeltingRecipe; import crazypants.enderio.machine.power.PowerDisplayUtil; -import crazypants.enderio.machine.recipe.IManyToOneRecipe; import crazypants.enderio.machine.recipe.IRecipe; import crazypants.enderio.machine.recipe.RecipeInput; @@ -27,7 +27,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { @Override public String getGuiTexture() { - return "enderio:textures/gui/alloySmelter.png"; + return "enderio:textures/gui/nei/alloySmelter.png"; } @Override @@ -87,18 +87,26 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { if(recipe.isValidInput(0, ingredient)) { ItemStack output = recipe.getOutputs()[0].getOutput(); AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); + res.setIngredientPermutation(res.input, ingredient); arecipes.add(res); } } } + @Override + public void drawBackground(int recipeIndex) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65); + } + @Override public void drawExtras(int recipeIndex) { - drawProgressBar(98, 25, 176, 0, 22, 13, 48, 3); - drawProgressBar(50, 25, 176, 0, 22, 13, 48, 3); + drawProgressBar(51, 31, 166, 0, 22, 13, 48, 3); + drawProgressBar(99, 31, 166, 0, 22, 13, 48, 3); AlloySmelterRecipe recipe = (AlloySmelterRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); - Minecraft.getMinecraft().fontRenderer.drawString(energyString, 100, 50, 0xFFFFFFFF); + GuiDraw.drawString(energyString, 100, 52, 0x808080, false); } public List getInputs(RecipeInput input) { @@ -119,7 +127,6 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { private PositionedStack output; private int energy; - // Possible energy cost in the future? public int getEnergy() { return energy; } @@ -137,20 +144,21 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { public AlloySmelterRecipe(int energy, RecipeInput[] ingredients, ItemStack result) { int recipeSize = ingredients.length; this.input = new ArrayList(); - int yOff = 8; if(recipeSize > 0) { - this.input.add(new PositionedStack(getInputs(ingredients[0]), 49, 14 - yOff)); + this.input.add(new PositionedStack(getInputs(ingredients[0]), 50, 13)); } if(recipeSize > 1) { - this.input.add(new PositionedStack(getInputs(ingredients[1]), 73, 4 - yOff)); + this.input.add(new PositionedStack(getInputs(ingredients[1]), 75, 3)); } if(recipeSize > 2) { - this.input.add(new PositionedStack(getInputs(ingredients[2]), 98, 14 - yOff)); + this.input.add(new PositionedStack(getInputs(ingredients[2]), 99, 13)); } if(result != null) { - this.output = new PositionedStack(result, 74, 54 - yOff); + this.output = new PositionedStack(result, 75, 42); } - this.energy = energy; + this.energy = energy; } + } + } diff --git a/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java b/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java index 3bb16a3d..4b6b9182 100644 --- a/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java @@ -6,8 +6,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.enchantment.Enchantment; @@ -15,6 +13,8 @@ import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.machine.enchanter.EnchanterRecipe; @@ -57,12 +57,12 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler { } Map enchants = EnchantmentHelper.getEnchantments(result); List recipes = EnchanterRecipeManager.getInstance().getRecipes(); - - for(Number id : enchants.keySet()) { + + for (Number id : enchants.keySet()) { if(id != null && id.intValue() >= 0 && id.intValue() < Enchantment.enchantmentsList.length) { Enchantment ench = Enchantment.enchantmentsList[id.intValue()]; if(ench != null && ench.getName() != null) { - + for (EnchanterRecipe recipe : recipes) { if(recipe.isValid() && recipe.getEnchantment().getName().equals(ench.getName())) { EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1); @@ -71,18 +71,17 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler { EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment); arecipes.add(rec); } - } - - } + } + + } } } - } @Override public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("EIOEnchanter") && getClass() == EnchanterRecipeHandler.class) { + if(outputId.equals("EIOEnchanter") && getClass() == EnchanterRecipeHandler.class) { List recipes = EnchanterRecipeManager.getInstance().getRecipes(); for (EnchanterRecipe recipe : recipes) { if(recipe.isValid()) { @@ -102,25 +101,29 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler { public void loadUsageRecipes(ItemStack ingredient) { List recipes = EnchanterRecipeManager.getInstance().getRecipes(); for (EnchanterRecipe recipe : recipes) { - if(recipe.isValid() && recipe.isInput(ingredient)) { + if(recipe.isValid()) { EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1); ItemStack output = new ItemStack(Items.enchanted_book); Items.enchanted_book.addEnchantment(output, enchantment); EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment); - arecipes.add(rec); + if(rec.contains(rec.input, ingredient)) { + rec.setIngredientPermutation(rec.input, ingredient); + arecipes.add(rec); + } } } } @Override - public void drawExtras(int recipeIndex) { + public void drawExtras(int recipeIndex) { EnchanterRecipeNEI recipe = (EnchanterRecipeNEI) arecipes.get(recipeIndex); + + GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 0x808080, false); + int cost = TileEnchanter.getEnchantmentCost(recipe.recipe, 1); if(cost > 0) { - String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(cost)}); - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - int sw = fr.getStringWidth(s); - fr.drawStringWithShadow(s, 90 - (sw/2), 48, 8453920); + String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) }); + GuiDraw.drawStringC(s, 83, 46, 0x80FF20); } } @@ -141,6 +144,10 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler { private EnchantmentData enchData; private EnchanterRecipe recipe; + public String getEnchantName() { + return StatCollector.translateToLocal(enchData.enchantmentobj.getName()); + } + @Override public List getIngredients() { return getCycledIngredients(cycleticks / 20, input); diff --git a/src/main/java/crazypants/enderio/nei/NEIEnderIOConfig.java b/src/main/java/crazypants/enderio/nei/NEIEnderIOConfig.java index 4812683f..819332b7 100644 --- a/src/main/java/crazypants/enderio/nei/NEIEnderIOConfig.java +++ b/src/main/java/crazypants/enderio/nei/NEIEnderIOConfig.java @@ -3,7 +3,6 @@ package crazypants.enderio.nei; import net.minecraft.item.ItemStack; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; -import cpw.mods.fml.common.Loader; import crazypants.enderio.EnderIO; import crazypants.enderio.conduit.gas.GasUtil; import crazypants.enderio.config.Config; @@ -12,9 +11,9 @@ public class NEIEnderIOConfig implements IConfigureNEI { @Override public void loadConfig() { - API.registerRecipeHandler(new AlloySmelterRecipeHandler()); + API.registerRecipeHandler(new AlloySmelterRecipeHandler()); API.registerUsageHandler(new AlloySmelterRecipeHandler()); - + API.registerRecipeHandler(new SagMillRecipeHandler()); API.registerUsageHandler(new SagMillRecipeHandler()); @@ -23,10 +22,10 @@ public class NEIEnderIOConfig implements IConfigureNEI { API.registerRecipeHandler(new EnchanterRecipeHandler()); API.registerUsageHandler(new EnchanterRecipeHandler()); - + API.registerRecipeHandler(new SliceAndSpliceRecipeHandler()); API.registerUsageHandler(new SliceAndSpliceRecipeHandler()); - + API.registerRecipeHandler(new SoulBinderRecipeHandler()); API.registerUsageHandler(new SoulBinderRecipeHandler()); @@ -68,8 +67,7 @@ public class NEIEnderIOConfig implements IConfigureNEI { @Override public String getVersion() { - return "0.0.1"; + return EnderIO.VERSION; } } - diff --git a/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java index f9d4fc65..fe745ae8 100644 --- a/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java @@ -1,20 +1,18 @@ package crazypants.enderio.nei; -import java.awt.Point; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; +import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; @@ -25,7 +23,6 @@ import crazypants.enderio.machine.power.PowerDisplayUtil; import crazypants.enderio.machine.recipe.Recipe; import crazypants.enderio.machine.recipe.RecipeInput; import crazypants.enderio.machine.recipe.RecipeOutput; -import crazypants.render.RenderUtil; public class SagMillRecipeHandler extends TemplateRecipeHandler { @@ -38,7 +35,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { @Override public String getGuiTexture() { - return "enderio:textures/gui/crusher.png"; + return "enderio:textures/gui/nei/crusher.png"; } public PositionedStack getResult() { @@ -57,7 +54,6 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { - //Set this up later to show all alloy recipes transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(149, 32, 16, 16), "EnderIOSagMill", new Object[0])); } @@ -93,24 +89,31 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { @Override public void loadUsageRecipes(ItemStack ingredient) { - List recipes = CrusherRecipeManager.getInstance().getRecipes(); for (Recipe recipe : recipes) { - if(recipe.isValidInput(0, ingredient)) { - MillRecipe res = new MillRecipe(recipe.getEnergyRequired(), recipe.getInputs()[0], recipe.getOutputs()); + MillRecipe res = new MillRecipe(recipe.getEnergyRequired(), recipe.getInputs()[0], recipe.getOutputs()); + if(res.contains(res.input, ingredient)) { + res.setIngredientPermutation(res.input, ingredient); arecipes.add(res); } - } + } + } + + @Override + public void drawBackground(int recipeIndex) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65); } @Override public void drawExtras(int recipeIndex) { - drawProgressBar(98, 33, 176, 0, 22, 13, 48, 3); - drawProgressBar(50, 33, 176, 0, 22, 13, 48, 3); + drawProgressBar(73, 20, 166, 0, 17, 24, 40, 1); + drawProgressBar(136, 12, 166, 24, 4, 16, 160, 11); MillRecipe recipe = (MillRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); - Minecraft.getMinecraft().fontRenderer.drawString(energyString, 90, 22, 0xFFFFFFFF); + GuiDraw.drawString(energyString, 96, 33, 0x808080, false); } @Override @@ -120,39 +123,14 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { if(chance > 0 && chance < 1) { int chanceInt = (int) (chance * 100); if(chanceInt == 0) { - currenttip.add("Less than 1%"); + currenttip.add(EnumChatFormatting.GRAY + "Chance: <1%"); } else { - currenttip.add(chanceInt + "% Chance"); + currenttip.add(EnumChatFormatting.GRAY + "Chance: " + chanceInt + "%"); } } return currenttip; } - public void renderIcon(IIcon icon, double x, double y, double width, double height, double zLevel) { - - Tessellator tessellator = Tessellator.instance; - - RenderUtil.bindItemTexture(); - GL11.glColor3f(1, 1, 1); - tessellator.startDrawingQuads(); - - float minU = icon.getMinU(); - float minV = icon.getMinV(); - float maxU = icon.getMaxU(); - float maxV = icon.getMaxV(); - tessellator.addVertexWithUV(x, y + height, zLevel, minU, maxV); - tessellator.addVertexWithUV(x + width, y + height, zLevel, maxU, maxV); - tessellator.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV); - tessellator.addVertexWithUV(x, y + 0, zLevel, minU, minV); - - tessellator.draw(); - } - - @Override - public void drawProgressBar(int x, int y, int tx, int ty, int w, int h, float completion, int direction) { - super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1); - } - public List getInputs(RecipeInput input) { List result = new ArrayList(); result.add(input.getInput()); @@ -165,8 +143,6 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { return result; } - private static Point offset = new Point(5, 11); - public class MillRecipe extends TemplateRecipeHandler.CachedRecipe { protected int numTargetOuput; @@ -176,7 +152,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { private ArrayList otherOutputs; private float[] outputChance; private int energy; - + public int getEnergy() { return energy; } @@ -220,20 +196,20 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { this.energy = energy; input = new ArrayList(2); - input.add(new PositionedStack(getInputs(ingredient), 80 - offset.x, 12 - offset.y)); + input.add(new PositionedStack(getInputs(ingredient), 74, 2)); - input.add(new PositionedStack(getBalls(), 122 - offset.x, 23 - offset.y)); + input.add(new PositionedStack(getBalls(), 116, 12)); - output = new PositionedStack(outputs[0].getOutput(), 49 - offset.x, 59 - offset.y); + output = new PositionedStack(outputs[0].getOutput(), 43, 46); otherOutputs = new ArrayList(); if(outputs.length > 1) { - otherOutputs.add(new PositionedStack(outputs[1].getOutput(), 70 - offset.x, 59 - offset.y)); + otherOutputs.add(new PositionedStack(outputs[1].getOutput(), 64, 46)); } if(outputs.length > 2) { - otherOutputs.add(new PositionedStack(outputs[2].getOutput(), 91 - offset.x, 59 - offset.y)); + otherOutputs.add(new PositionedStack(outputs[2].getOutput(), 85, 46)); } if(outputs.length > 3) { - otherOutputs.add(new PositionedStack(outputs[3].getOutput(), 112 - offset.x, 59 - offset.y)); + otherOutputs.add(new PositionedStack(outputs[3].getOutput(), 106, 46)); } outputChance = new float[outputs.length]; diff --git a/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java index af694a45..0a401d2b 100644 --- a/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java @@ -5,10 +5,13 @@ import java.awt.Rectangle; import java.util.ArrayList; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.machine.power.PowerDisplayUtil; @@ -82,16 +85,26 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler { for (IRecipe recipe : recipes) { if(recipe.isValidInput(0, ingredient)) { SliceAndSpliceRecipe res = new SliceAndSpliceRecipe(recipe); + res.setIngredientPermutation(res.input, ingredient); arecipes.add(res); } } } + @Override + public void drawBackground(int recipeIndex) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(16, 0, 29, 11, 142, 65); + } + @Override public void drawExtras(int recipeIndex) { + drawProgressBar(90, 35, 177, 14, 23, 17, 120, 0); + SliceAndSpliceRecipe recipe = (SliceAndSpliceRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); - Minecraft.getMinecraft().fontRenderer.drawString(energyString, 100, 58, 0xFFFFFFFF); + GuiDraw.drawString(energyString, 100, 57, 0x808080, false); } public List getInputs(RecipeInput input) { @@ -130,7 +143,7 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler { int recipeSize = recipe.getInputs().length; input = new ArrayList(); int yOff = 11; - int xOff = 5; + int xOff = 13; Point pos; for (RecipeInput recipeInput : recipe.getInputs()) { diff --git a/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java index 6a19a6e8..356e0b84 100644 --- a/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java @@ -2,35 +2,26 @@ package crazypants.enderio.nei; import java.awt.Rectangle; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.machine.IMachineRecipe; -import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; -import crazypants.enderio.machine.enchanter.EnchanterRecipe; -import crazypants.enderio.machine.enchanter.EnchanterRecipeManager; -import crazypants.enderio.machine.enchanter.GuiEnchanter; -import crazypants.enderio.machine.enchanter.TileEnchanter; -import crazypants.enderio.machine.recipe.RecipeInput; +import crazypants.enderio.machine.power.PowerDisplayUtil; import crazypants.enderio.machine.soul.GuiSoulBinder; import crazypants.enderio.machine.soul.ISoulBinderRecipe; -import crazypants.enderio.nei.EnchanterRecipeHandler.EnchanterRecipeNEI; public class SoulBinderRecipeHandler extends TemplateRecipeHandler { @@ -110,9 +101,9 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler { } for (IMachineRecipe recipe : recipes.values()) { if(recipe instanceof ISoulBinderRecipe) { - ISoulBinderRecipe sbr = (ISoulBinderRecipe) recipe; - if(sbr.getInputStack().isItemEqual(ingredient)) { - arecipes.add(new SoulBinderRecipeNEI((ISoulBinderRecipe) recipe)); + SoulBinderRecipeNEI sbr = new SoulBinderRecipeNEI((ISoulBinderRecipe) recipe); + if(sbr.contains(sbr.input, ingredient)) { + arecipes.add(sbr); } } } @@ -120,36 +111,48 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler { } @Override - public void drawExtras(int recipeIndex) { + public void drawBackground(int recipeIndex) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(18, 0, 29, 11, 142, 65); } - // public List getInputs(RecipeInput input) { - // List result = new ArrayList(); - // result.add(input.getInput()); - // ItemStack[] equivs = input.getEquivelentInputs(); - // if(equivs != null && equivs.length > 0) { - // result.addAll(Arrays.asList(equivs)); - // } - // return result; - // } + @Override + public void drawExtras(int recipeIndex) { + drawProgressBar(70, 23, 177, 14, 23, 17, 160, 0); + + SoulBinderRecipeNEI recipe = (SoulBinderRecipeNEI) arecipes.get(recipeIndex); + + String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); + GuiDraw.drawStringC(energyString, 83, 45, 0x808080, false); + + int cost = recipe.getExperience(); + if(cost > 0) { + String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) }); + GuiDraw.drawStringC(s, 83, 55, 0x80FF20); + } + } private static final ArrayList EMPTY_VIAL_OUTPUT = new ArrayList(); static { - EMPTY_VIAL_OUTPUT.add(new PositionedStack(new ItemStack(EnderIO.itemSoulVessel), 107, 23)); + EMPTY_VIAL_OUTPUT.add(new PositionedStack(new ItemStack(EnderIO.itemSoulVessel), 101, 23)); } public class SoulBinderRecipeNEI extends TemplateRecipeHandler.CachedRecipe { private final ArrayList input = new ArrayList(); - private final PositionedStack output; - private int energy; + private int experience; public int getEnergy() { return energy; } + public int getExperience() { + return experience; + } + @Override public List getIngredients() { return getCycledIngredients(cycleticks / 20, input); @@ -166,18 +169,20 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler { } public SoulBinderRecipeNEI(ISoulBinderRecipe recipe) { - this(recipe.getInputStack(), recipe.getOutputStack(), recipe.getEnergyRequired(), recipe.getSupportedSouls()); + this(recipe.getInputStack(), recipe.getOutputStack(), recipe.getEnergyRequired(), recipe.getExperienceRequired(), recipe.getSupportedSouls()); } - public SoulBinderRecipeNEI(ItemStack inputStack, ItemStack result, int energy, List list) { + public SoulBinderRecipeNEI(ItemStack inputStack, ItemStack result, int energy, int experience, List list) { int yOff = 11; - int xOff = 6; + int xOff = 11; input.add(new PositionedStack(getSoulVialInputs(list), 38 - xOff, 34 - yOff)); - input.add(new PositionedStack(inputStack, 60 - xOff, 34 - yOff)); + input.add(new PositionedStack(inputStack, 59 - xOff, 34 - yOff)); output = new PositionedStack(result, 134 - xOff, 34 - yOff); + this.energy = energy; + this.experience = experience; } private List getSoulVialInputs(List mobs) { diff --git a/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java b/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java index e7839d6f..509cfb64 100644 --- a/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java @@ -1,17 +1,12 @@ package crazypants.enderio.nei; -import java.awt.Color; import java.awt.Point; 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.inventory.GuiContainer; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; @@ -28,7 +23,6 @@ import crazypants.enderio.machine.recipe.IRecipe; import crazypants.enderio.machine.recipe.RecipeInput; import crazypants.enderio.machine.still.GuiVat; import crazypants.enderio.machine.still.VatRecipeManager; -import crazypants.render.ColorUtil; import crazypants.render.RenderUtil; public class VatRecipeHandler extends TemplateRecipeHandler { @@ -124,12 +118,20 @@ public class VatRecipeHandler extends TemplateRecipeHandler { if(addRecipe) { FluidStack output = recipe.getOutputs()[0].getFluidOutput(); InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); + res.setIngredientPermutation(res.inputs, ingredient); arecipes.add(res); } } } + @Override + public void drawBackground(int recipeIndex) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(22, 0, 27, 11, 123, 52); + } + @Override public void drawExtras(int recipeIndex) { InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex); @@ -142,24 +144,15 @@ public class VatRecipeHandler extends TemplateRecipeHandler { .renderGuiTank(rec.result, rec.result.amount, rec.result.amount, outTankBounds.x, outTankBounds.y, 0, outTankBounds.width, outTankBounds.height); } - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation(); - int width = fr.getStringWidth(energyString); - - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - int col = ColorUtil.getRGBA(0.75f, 1.0f, 1.0f, 1.0f); - fr.drawString(energyString, 86 - width / 2, 55, col, true); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1, 1, 1, 1); + GuiDraw.drawStringC(energyString, 86, 54, 0x808080, false); Fluid outputFluid = rec.result.getFluid(); List stacks = rec.getIngredients(); for (PositionedStack ps : stacks) { float mult = VatRecipeManager.getInstance().getMultiplierForInput(ps.item, outputFluid); String str = "x" + mult; - fr.drawString(str, ps.relx + 8 - fr.getStringWidth(str) / 2, ps.rely + 19, ColorUtil.getRGB(Color.gray), false); - + GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false); } } @@ -195,41 +188,16 @@ public class VatRecipeHandler extends TemplateRecipeHandler { InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(index); if(in) { if(rec.inFluid != null && rec.inFluid.getFluid() != null) { - list.add(rec.inFluid.getFluid().getLocalizedName()); + list.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid)); } } else { if(rec.result != null && rec.result.getFluid() != null) { - list.add(rec.result.getFluid().getLocalizedName()); + list.add(rec.result.getFluid().getLocalizedName(rec.result)); } } return list; } - public void renderIcon(IIcon icon, double x, double y, double width, double height, double zLevel) { - - Tessellator tessellator = Tessellator.instance; - - RenderUtil.bindItemTexture(); - GL11.glColor3f(1, 1, 1); - tessellator.startDrawingQuads(); - - float minU = icon.getMinU(); - float minV = icon.getMinV(); - float maxU = icon.getMaxU(); - float maxV = icon.getMaxV(); - tessellator.addVertexWithUV(x, y + height, zLevel, minU, maxV); - tessellator.addVertexWithUV(x + width, y + height, zLevel, maxU, maxV); - tessellator.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV); - tessellator.addVertexWithUV(x, y + 0, zLevel, minU, minV); - - tessellator.draw(); - } - - @Override - public void drawProgressBar(int x, int y, int tx, int ty, int w, int h, float completion, int direction) { - super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1); - } - public List getInputs(RecipeInput input) { List result = new ArrayList(); result.add(input.getInput());