diff --git a/resources/assets/tinker/textures/gui/nei/casting.png b/resources/assets/tinker/textures/gui/nei/casting.png new file mode 100644 index 00000000000..d9d5487a551 Binary files /dev/null and b/resources/assets/tinker/textures/gui/nei/casting.png differ diff --git a/resources/assets/tinker/textures/gui/nei/smeltery.png b/resources/assets/tinker/textures/gui/nei/smeltery.png new file mode 100644 index 00000000000..3c6f3228c00 Binary files /dev/null and b/resources/assets/tinker/textures/gui/nei/smeltery.png differ diff --git a/src/main/java/tconstruct/smeltery/nei/NEITinkerSmelteryConfig.java b/src/main/java/tconstruct/smeltery/nei/NEITinkerSmelteryConfig.java new file mode 100644 index 00000000000..3ab3ba2b054 --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/NEITinkerSmelteryConfig.java @@ -0,0 +1,34 @@ +package tconstruct.smeltery.nei; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; + +public class NEITinkerSmelteryConfig implements IConfigureNEI +{ + + @Override + public void loadConfig () + { + API.registerRecipeHandler(new RecipeHandlerMelting()); + API.registerUsageHandler(new RecipeHandlerMelting()); + API.registerRecipeHandler(new RecipeHandlerAlloying()); + API.registerUsageHandler(new RecipeHandlerAlloying()); + API.registerRecipeHandler(new RecipeHandlerCastingTable()); + API.registerUsageHandler(new RecipeHandlerCastingTable()); + API.registerRecipeHandler(new RecipeHandlerCastingBasin()); + API.registerUsageHandler(new RecipeHandlerCastingBasin()); + } + + @Override + public String getName () + { + return "TinkerSmeltery"; + } + + @Override + public String getVersion () + { + return "${version}"; + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerAlloying.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerAlloying.java new file mode 100644 index 00000000000..17539dce3a4 --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerAlloying.java @@ -0,0 +1,167 @@ +package tconstruct.smeltery.nei; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraftforge.fluids.FluidStack; + +import org.lwjgl.opengl.GL11; + +import tconstruct.library.crafting.AlloyMix; +import tconstruct.library.crafting.Smeltery; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; + +public class RecipeHandlerAlloying extends RecipeHandlerBase +{ + + public static final Rectangle OUTPUT_TANK = new Rectangle(118, 9, 18, 32); + + public class CachedAlloyingRecipe extends CachedBaseRecipe + { + private List fluidTanks; + private int minAmount; + + public CachedAlloyingRecipe(AlloyMix recipe) + { + this.fluidTanks = new ArrayList(); + + int maxAmount = recipe.mixers.get(0).amount; + int mult = 1; + this.minAmount = maxAmount; + for (FluidStack stack : recipe.mixers) + { + if (stack.amount > maxAmount) + { + maxAmount = stack.amount; + } + if (stack.amount < this.minAmount) + { + this.minAmount = stack.amount; + } + } + FluidTankElement tank = new FluidTankElement(OUTPUT_TANK, maxAmount * mult, recipe.result); + tank.fluid.amount *= mult; + this.fluidTanks.add(tank); + + int width = 36 / recipe.mixers.size(); + int counter = 0; + for (FluidStack stack : recipe.mixers) + { + if (counter == recipe.mixers.size() - 1) + { + tank = new FluidTankElement(new Rectangle(21 + width * counter, 9, 36 - width * counter, 32), maxAmount * mult, stack); + } + else + { + tank = new FluidTankElement(new Rectangle(21 + width * counter, 9, width, 32), maxAmount * mult, stack); + } + tank.fluid.amount *= mult; + this.fluidTanks.add(tank); + counter++; + } + } + + @Override + public PositionedStack getIngredient () + { + return null; + } + + @Override + public PositionedStack getResult () + { + return null; + } + + @Override + public List getFluidTanks () + { + return this.fluidTanks; + } + } + + @Override + public String getRecipeName () + { + return "Smeltery Alloying"; + } + + @Override + public String getRecipeID () + { + return "tconstruct.smeltery.alloying"; + } + + @Override + public String getGuiTexture () + { + return "tinker:textures/gui/nei/smeltery.png"; + } + + @Override + public void loadTransferRects () + { + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(76, 21, 22, 15), this.getRecipeID(), new Object[0])); + } + + @Override + public void drawBackground (int recipe) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 62, 160, 65); + } + + @Override + public void loadCraftingRecipes (String outputId, Object... results) + { + if (outputId.equals(this.getRecipeID())) + { + for (AlloyMix recipe : Smeltery.getAlloyList()) + { + if (!recipe.mixers.isEmpty()) + { + this.arecipes.add(new CachedAlloyingRecipe(recipe)); + } + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes (FluidStack result) + { + for (AlloyMix recipe : Smeltery.getAlloyList()) + { + if (areFluidsEqual(recipe.result, result) && !recipe.mixers.isEmpty()) + { + this.arecipes.add(new CachedAlloyingRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes (FluidStack ingredient) + { + for (Iterator i = Smeltery.getAlloyList().iterator(); i.hasNext();) + { + AlloyMix recipe = i.next(); + for (FluidStack liquid : recipe.mixers) + { + if (areFluidsEqual(liquid, ingredient) && !recipe.mixers.isEmpty()) + { + this.arecipes.add(new CachedAlloyingRecipe(recipe)); + break; + } + } + } + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerBase.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerBase.java new file mode 100644 index 00000000000..f886dd279ae --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerBase.java @@ -0,0 +1,347 @@ +package tconstruct.smeltery.nei; + +import java.awt.Point; +import java.awt.Rectangle; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fluids.IFluidContainerItem; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; + +public abstract class RecipeHandlerBase extends TemplateRecipeHandler +{ + + public abstract class CachedBaseRecipe extends CachedRecipe + { + public abstract List getFluidTanks (); + } + + public abstract String getRecipeID (); + + public void loadCraftingRecipes (FluidStack result) + { + } + + public void loadUsageRecipes (FluidStack ingredient) + { + } + + @Override + public void drawForeground (int recipe) + { + super.drawForeground(recipe); + this.drawFluidTanks(recipe); + } + + @Override + public void loadCraftingRecipes (String outputId, Object... results) + { + try + { + if (outputId.equals("liquid") && results.length == 1 && results[0] instanceof FluidStack) + { + this.loadCraftingRecipes((FluidStack) results[0]); + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + catch (Throwable ex) + { + ex.printStackTrace(); + } + } + + @Override + public void loadCraftingRecipes (ItemStack result) + { + FluidStack fluid = getFluidStack(result); + if (fluid != null) + { + this.loadCraftingRecipes(fluid); + } + } + + @Override + public void loadUsageRecipes (String inputId, Object... ingredients) + { + try + { + if (inputId.equals("liquid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) + { + this.loadUsageRecipes((FluidStack) ingredients[0]); + } + else + { + super.loadUsageRecipes(inputId, ingredients); + } + } + catch (Throwable ex) + { + ex.printStackTrace(); + } + } + + @Override + public void loadUsageRecipes (ItemStack result) + { + FluidStack fluid = getFluidStack(result); + if (fluid != null) + { + this.loadUsageRecipes(fluid); + } + } + + @Override + public List handleTooltip (GuiRecipe guiRecipe, List currenttip, int recipe) + { + super.handleTooltip(guiRecipe, currenttip, recipe); + CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); + if (GuiContainerManager.shouldShowTooltip(guiRecipe)) + { + Point mouse = GuiDraw.getMousePosition(); + Point offset = guiRecipe.getRecipePosition(recipe); + Point relMouse = new Point(mouse.x - ((guiRecipe.width - 176) / 2) - offset.x, mouse.y - ((guiRecipe.height - 166) / 2) - offset.y); + for (FluidTankElement tank : crecipe.getFluidTanks()) + { + if (tank.position.contains(relMouse)) + { + tank.handleTooltip(currenttip); + } + } + } + return currenttip; + } + + @Override + public boolean keyTyped (GuiRecipe gui, char keyChar, int keyCode, int recipe) + { + if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) + { + if (this.transferFluidTank(gui, recipe, false)) + { + return true; + } + } + else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) + { + if (this.transferFluidTank(gui, recipe, true)) + { + return true; + } + } + return super.keyTyped(gui, keyChar, keyCode, recipe); + } + + @Override + public boolean mouseClicked (GuiRecipe gui, int button, int recipe) + { + if (button == 0) + { + if (this.transferFluidTank(gui, recipe, false)) + { + return true; + } + } + else if (button == 1) + { + if (this.transferFluidTank(gui, recipe, true)) + { + return true; + } + } + return super.mouseClicked(gui, button, recipe); + } + + protected boolean transferFluidTank (GuiRecipe guiRecipe, int recipe, boolean usage) + { + CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); + Point mousepos = GuiDraw.getMousePosition(); + Point offset = guiRecipe.getRecipePosition(recipe); + Point relMouse = new Point(mousepos.x - ((guiRecipe.width - 176) / 2) - offset.x, mousepos.y - ((guiRecipe.height - 166) / 2) - offset.y); + for (FluidTankElement tank : crecipe.getFluidTanks()) + { + if (tank.position.contains(relMouse)) + { + if ((tank.fluid != null) && tank.fluid.amount > 0) + { + if (usage) + { + if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.fluid })) + { + return false; + } + } + else + { + if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.fluid })) + { + return false; + } + } + return true; + } + } + } + + return false; + } + + public void drawFluidTanks (int recipe) + { + CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe); + for (FluidTankElement fluidTank : crecipe.getFluidTanks()) + { + fluidTank.draw(); + } + } + + public static FluidStack getFluidStack (ItemStack stack) + { + if (stack == null) + { + return null; + } + Item item = stack.getItem(); + FluidStack fluidStack = null; + if ((item instanceof IFluidContainerItem)) + { + fluidStack = ((IFluidContainerItem) item).getFluid(stack); + } + if (fluidStack == null) + { + fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack); + } + if ((fluidStack == null) && (Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock)) + { + Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid(); + if (fluid != null) + { + return new FluidStack(fluid, 1000); + } + } + return fluidStack; + } + + public static boolean areFluidsEqual (FluidStack fluidStack1, FluidStack fluidStack2) + { + if (fluidStack1 == null || fluidStack2 == null) + { + return false; + } + return fluidStack1.isFluidEqual(fluidStack2); + } + + public static String getMoltenTooltip (FluidStack fluid) + { + if (fluid == null) + { + return null; + } + return null; + } + + public static class FluidTankElement + { + public Rectangle position; + public FluidStack fluid; + public int capacity; + public boolean flowingTexture = false; + + public FluidTankElement(Rectangle position, int capacity, FluidStack fluid) + { + this.position = position; + this.capacity = capacity; + this.fluid = fluid; + } + + public List handleTooltip (List currenttip) + { + if (this.fluid == null || this.fluid.getFluid() == null || this.fluid.amount <= 0) + { + return currenttip; + } + currenttip.add(this.fluid.getLocalizedName()); + currenttip.add(EnumChatFormatting.GRAY.toString() + this.fluid.amount + " mB"); + return currenttip; + } + + public void draw () + { + if (this.fluid == null || this.fluid.getFluid() == null || this.fluid.amount <= 0) + { + return; + } + IIcon fluidIcon = null; + if (this.flowingTexture && this.fluid.getFluid().getFlowingIcon() != null) + { + fluidIcon = this.fluid.getFluid().getFlowingIcon(); + } + else if (this.fluid.getFluid().getStillIcon() != null) + { + fluidIcon = this.fluid.getFluid().getStillIcon(); + } + else + { + return; + } + + GuiDraw.changeTexture(TextureMap.locationBlocksTexture); + int color = this.fluid.getFluid().getColor(this.fluid); + GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF)); + GL11.glDisable(GL11.GL_BLEND); + + int amount = Math.max(Math.min(this.position.height, this.fluid.amount * this.position.height / this.capacity), 1); + int posY = this.position.y + this.position.height - amount; + + for (int i = 0; i < this.position.width; i += 16) + { + for (int j = 0; j < amount; j += 16) + { + int drawWidth = Math.min(this.position.width - i, 16); + int drawHeight = Math.min(amount - j, 16); + + int drawX = this.position.x + i; + int drawY = posY + j; + + double minU = fluidIcon.getMinU(); + double maxU = fluidIcon.getMaxU(); + double minV = fluidIcon.getMinV(); + double maxV = fluidIcon.getMaxV(); + + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(drawX, drawY + drawHeight, 0, minU, minV + (maxV - minV) * drawHeight / 16F); + tessellator.addVertexWithUV(drawX + drawWidth, drawY + drawHeight, 0, minU + (maxU - minU) * drawWidth / 16F, minV + (maxV - minV) * drawHeight / 16F); + tessellator.addVertexWithUV(drawX + drawWidth, drawY, 0, minU + (maxU - minU) * drawWidth / 16F, minV); + tessellator.addVertexWithUV(drawX, drawY, 0, minU, minV); + tessellator.draw(); + } + } + + GL11.glEnable(GL11.GL_BLEND); + } + + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBase.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBase.java new file mode 100644 index 00000000000..ca50f7ccf98 --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBase.java @@ -0,0 +1,135 @@ +package tconstruct.smeltery.nei; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import tconstruct.library.crafting.CastingRecipe; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; + +public abstract class RecipeHandlerCastingBase extends RecipeHandlerBase +{ + public static final Rectangle MOLTEN_FLOW = new Rectangle(60, 8, 6, 11); + public static final Rectangle MOLTEN_FLOW_NO_ITEM = new Rectangle(60, 8, 6, 27); + + public class CachedCastingRecipe extends CachedBaseRecipe + { + private List resources; + private FluidTankElement metal; + private PositionedStack output = null; + + public CachedCastingRecipe(CastingRecipe recipe) + { + this.metal = new FluidTankElement(MOLTEN_FLOW, recipe.castingMetal.amount, recipe.castingMetal); + this.metal.flowingTexture = true; + this.resources = new ArrayList(); + if (recipe.cast != null) + { + this.resources.add(new PositionedStack(recipe.cast, 55, 19)); + } + else + { + this.metal.position = MOLTEN_FLOW_NO_ITEM; + } + this.output = new PositionedStack(recipe.output, 110, 18); + } + + @Override + public List getIngredients () + { + return getCycledIngredients(cycleticks / 20, this.resources); + } + + @Override + public PositionedStack getResult () + { + return this.output; + } + + @Override + public List getFluidTanks () + { + List res = new ArrayList(); + res.add(this.metal); + return res; + } + } + + @Override + public String getRecipeID () + { + return "tconstruct.smeltery.casting"; + } + + @Override + public String getGuiTexture () + { + return "tinker:textures/gui/nei/casting.png"; + } + + @Override + public void loadTransferRects () + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(76, 18, 22, 15), this.getRecipeID(), new Object[0])); + } + + public abstract List getCastingRecipes (); + + @Override + public void loadCraftingRecipes (String outputId, Object... results) + { + if (outputId.equals(this.getRecipeID())) + { + for (CastingRecipe recipe : this.getCastingRecipes()) + { + this.arecipes.add(new CachedCastingRecipe(recipe)); + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes (ItemStack result) + { + for (CastingRecipe recipe : getCastingRecipes()) + { + if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) + { + this.arecipes.add(new CachedCastingRecipe(recipe)); + } + } + } + + @Override + public void loadUsageRecipes (ItemStack ingred) + { + for (CastingRecipe recipe : getCastingRecipes()) + { + if (NEIServerUtils.areStacksSameTypeCrafting(recipe.cast, ingred)) + { + CachedCastingRecipe irecipe = new CachedCastingRecipe(recipe); + irecipe.setIngredientPermutation(irecipe.resources, ingred); + this.arecipes.add(irecipe); + } + } + } + + @Override + public void loadUsageRecipes (FluidStack ingredient) + { + for (CastingRecipe recipe : getCastingRecipes()) + { + if (areFluidsEqual(recipe.castingMetal, ingredient)) + { + this.arecipes.add(new CachedCastingRecipe(recipe)); + } + } + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBasin.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBasin.java new file mode 100644 index 00000000000..1c977d7485a --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingBasin.java @@ -0,0 +1,41 @@ +package tconstruct.smeltery.nei; + +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import tconstruct.library.TConstructRegistry; +import tconstruct.library.crafting.CastingRecipe; +import tconstruct.library.crafting.LiquidCasting; +import codechicken.lib.gui.GuiDraw; + +public class RecipeHandlerCastingBasin extends RecipeHandlerCastingBase +{ + + @Override + public String getRecipeName () + { + return "Casting Basin"; + } + + @Override + public void drawBackground (int recipe) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(30, 0, 0, 62, 112, 55); + } + + @Override + public List getCastingRecipes () + { + LiquidCasting casting = TConstructRegistry.getBasinCasting(); + if (casting == null) + { + return new ArrayList(); + } + return casting.getCastingRecipes(); + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingTable.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingTable.java new file mode 100644 index 00000000000..1021733f50e --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerCastingTable.java @@ -0,0 +1,41 @@ +package tconstruct.smeltery.nei; + +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import tconstruct.library.TConstructRegistry; +import tconstruct.library.crafting.CastingRecipe; +import tconstruct.library.crafting.LiquidCasting; +import codechicken.lib.gui.GuiDraw; + +public class RecipeHandlerCastingTable extends RecipeHandlerCastingBase +{ + + @Override + public String getRecipeName () + { + return "Casting Table"; + } + + @Override + public void drawBackground (int recipe) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(30, 0, 0, 0, 112, 55); + } + + @Override + public List getCastingRecipes () + { + LiquidCasting casting = TConstructRegistry.getTableCasting(); + if (casting == null) + { + return new ArrayList(); + } + return casting.getCastingRecipes(); + } + +} diff --git a/src/main/java/tconstruct/smeltery/nei/RecipeHandlerMelting.java b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerMelting.java new file mode 100644 index 00000000000..9706ff91855 --- /dev/null +++ b/src/main/java/tconstruct/smeltery/nei/RecipeHandlerMelting.java @@ -0,0 +1,138 @@ +package tconstruct.smeltery.nei; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import mantle.utils.ItemMetaWrapper; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import org.lwjgl.opengl.GL11; + +import tconstruct.library.crafting.Smeltery; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; + +public class RecipeHandlerMelting extends RecipeHandlerBase +{ + + public static final Rectangle MOLTEN_TANK = new Rectangle(115, 20, 18, 18); + + public class CachedMeltingRecipe extends CachedBaseRecipe + { + private PositionedStack input; + private int temperature; + private FluidTankElement output; + + public CachedMeltingRecipe(ItemStack input) + { + this.input = new PositionedStack(input, 28, 21); + this.temperature = Smeltery.getLiquifyTemperature(input); + this.output = new FluidTankElement(MOLTEN_TANK, 1, Smeltery.getSmelteryResult(input)); + this.output.capacity = this.output.fluid != null ? this.output.fluid.amount : 1000; + } + + @Override + public PositionedStack getIngredient () + { + return this.input; + } + + @Override + public PositionedStack getResult () + { + return null; + } + + @Override + public List getFluidTanks () + { + List tanks = new ArrayList(); + tanks.add(this.output); + return tanks; + } + } + + @Override + public String getRecipeName () + { + return "Smeltery Melting"; + } + + @Override + public String getRecipeID () + { + return "tconstruct.smeltery.melting"; + } + + @Override + public String getGuiTexture () + { + return "tinker:textures/gui/nei/smeltery.png"; + } + + @Override + public void loadTransferRects () + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(72, 20, 16, 34), this.getRecipeID(), new Object[0])); + } + + @Override + public void drawBackground (int recipe) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 160, 55); + } + + @Override + public void drawExtras (int recipe) + { + int temperature = ((CachedMeltingRecipe) this.arecipes.get(recipe)).temperature; + GuiDraw.drawStringC(temperature + " C", 81, 9, 0x808080, false); + } + + @Override + public void loadCraftingRecipes (String outputId, Object... results) + { + if (outputId.equals(getRecipeID())) + { + for (ItemMetaWrapper key : Smeltery.getSmeltingList().keySet()) + { + this.arecipes.add(new CachedMeltingRecipe(new ItemStack(key.item, 1, key.meta))); + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes (FluidStack result) + { + for (Entry pair : Smeltery.getSmeltingList().entrySet()) + { + if (areFluidsEqual(pair.getValue(), result)) + { + this.arecipes.add(new CachedMeltingRecipe(new ItemStack(pair.getKey().item, 1, pair.getKey().meta))); + } + } + } + + @Override + public void loadUsageRecipes (ItemStack ingred) + { + for (ItemMetaWrapper key : Smeltery.getSmeltingList().keySet()) + { + if (NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(key.item, 1, key.meta), ingred)) + { + this.arecipes.add(new CachedMeltingRecipe(new ItemStack(key.item, 1, key.meta))); + } + } + } + +}