diff --git a/legacy/mekanism.client.nei/AdvancedMachineRecipeHandler.java b/legacy/mekanism.client.nei/AdvancedMachineRecipeHandler.java deleted file mode 100644 index 536a86cfc..000000000 --- a/legacy/mekanism.client.nei/AdvancedMachineRecipeHandler.java +++ /dev/null @@ -1,306 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasStack; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.recipe.machines.AdvancedMachineRecipe; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public abstract String getRecipeId(); - - public abstract Collection getRecipes(); - - public abstract List getFuelStacks(Gas gasType); - - public abstract ProgressBar getProgressType(); - - @Override - public void addGuiElements() - { - guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16)); - guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 30, 34).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52)); - guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30)); - - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F; - } - }, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37)); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(12, 0, 28, 5, 144, 68); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -16, -5); - } - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.input.gasType != null && ticksPassed >= 20) - { - int displayInt = ticksPassed < 40 ? (ticksPassed-20)*12 / 20 : 12; - displayGauge(45, 32 + 12 - displayInt, 6, displayInt, new GasStack(recipe.input.gasType, 1)); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(63, 34, 24, 7), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(AdvancedMachineRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType))); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(AdvancedMachineRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result)) - { - arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType))); - } - } - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiAdvancedMachine.png"; - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(AdvancedMachineRecipe irecipe : getRecipes()) - { - if(irecipe.getInput().gasType == ((GasStack)ingredients[0]).getGas()) - { - arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType))); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(AdvancedMachineRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().itemStack, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType))); - } - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) - { - currenttip.add(((CachedIORecipe)arecipes.get(recipe)).input.gasType.getLocalizedName()); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - GasStack stack = null; - - if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) - { - stack = new GasStack(((CachedIORecipe)arecipes.get(recipe)).input.gasType, 1); - } - - if(stack != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - GasStack stack = null; - - if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) - { - stack = new GasStack(((CachedIORecipe)arecipes.get(recipe)).input.gasType, 1); - } - - if(stack != null) - { - if(button == 0) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public List fuelStacks; - - public AdvancedMachineInput input; - - public PositionedStack outputStack; - - @Override - public PositionedStack getIngredient() - { - return new PositionedStack(input.itemStack, 40, 12); - } - - @Override - public PositionedStack getResult() - { - return outputStack; - } - - @Override - public PositionedStack getOtherStack() - { - return new PositionedStack(fuelStacks.get(cycleticks/40 % fuelStacks.size()), 40, 48); - } - - public CachedIORecipe(AdvancedMachineInput adv, ItemStack output, List fuels) - { - input = adv; - outputStack = new PositionedStack(output, 100, 30); - fuelStacks = fuels; - } - - public CachedIORecipe(AdvancedMachineRecipe recipe, List fuels) - { - this(recipe.getInput(), recipe.getOutput().output, fuels); - } - } -} diff --git a/legacy/mekanism.client.nei/BaseRecipeHandler.java b/legacy/mekanism.client.nei/BaseRecipeHandler.java deleted file mode 100644 index 5fe5f3879..000000000 --- a/legacy/mekanism.client.nei/BaseRecipeHandler.java +++ /dev/null @@ -1,172 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; -import static codechicken.lib.gui.GuiDraw.gui; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.IGuiWrapper; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.render.MekanismRenderer; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.FluidStack; -import codechicken.nei.recipe.GuiCraftingRecipe; -import codechicken.nei.recipe.GuiUsageRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public abstract class BaseRecipeHandler extends TemplateRecipeHandler implements IGuiWrapper -{ - public BaseRecipeHandler() - { - addGuiElements(); - } - - public Set guiElements = new HashSet(); - - public abstract void addGuiElements(); - - public void displayGauge(int length, int xPos, int yPos, int overlayX, int overlayY, int scale, FluidStack fluid, GasStack gas) - { - if(fluid == null && gas == null) - { - return; - } - - int start = 0; - - while(true) - { - int renderRemaining = 0; - - if(scale > 16) - { - renderRemaining = 16; - scale -= 16; - } - else { - renderRemaining = scale; - scale = 0; - } - - changeTexture(MekanismRenderer.getBlocksTexture()); - - if(fluid != null) - { - gui.drawTexturedModelRectFromIcon(xPos, yPos + length - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining)); - } - else if(gas != null) - { - gui.drawTexturedModelRectFromIcon(xPos, yPos + length - renderRemaining - start, gas.getGas().getIcon(), 16, 16 - (16 - renderRemaining)); - } - - start+=16; - - if(renderRemaining == 0 || scale == 0) - { - break; - } - } - - changeTexture(getGuiTexture()); - drawTexturedModalRect(xPos, yPos, overlayX, overlayY, 16, length+1); - } - - /* - * true = usage, false = recipe - */ - public boolean doGasLookup(GasStack stack, boolean type) - { - if(stack != null && stack.amount > 0) - { - if(type) - { - if(!GuiUsageRecipe.openRecipeGui("gas", new Object[] {stack})) - { - return false; - } - } - else { - if(!GuiCraftingRecipe.openRecipeGui("gas", new Object[] {stack})) - { - return false; - } - } - - return true; - } - - return false; - } - - public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas) - { - if(gas == null) - { - return; - } - - changeTexture(MekanismRenderer.getBlocksTexture()); - gui.drawTexturedModelRectFromIcon(xPos, yPos, gas.getGas().getIcon(), sizeX, sizeY); - } - - public String stripTexture() - { - return getGuiTexture().replace("mekanism:gui/", ""); - } - - /* - * true = usage, false = recipe - */ - public boolean doFluidLookup(FluidStack stack, boolean type) - { - if(stack != null && stack.amount > 0) - { - if(type) - { - if(!GuiUsageRecipe.openRecipeGui("fluid", new Object[] {stack})) - { - return false; - } - } - else { - if(!GuiCraftingRecipe.openRecipeGui("fluid", new Object[] {stack})) - { - return false; - } - } - - return true; - } - - return false; - } - - @Override - public void drawTexturedRect(int x, int y, int u, int v, int w, int h) - { - drawTexturedModalRect(x, y, u, v, w, h); - } - - @Override - public void drawTexturedRectFromIcon(int x, int y, IIcon icon, int w, int h) - { - gui.drawTexturedModelRectFromIcon(x, y, icon, w, h); - } - - @Override - public void displayTooltip(String s, int xAxis, int yAxis) {} - - @Override - public void displayTooltips(List list, int xAxis, int yAxis) {} - - @Override - public FontRenderer getFont() - { - return null; - } -} diff --git a/legacy/mekanism.client.nei/ChanceMachineRecipeHandler.java b/legacy/mekanism.client.nei/ChanceMachineRecipeHandler.java deleted file mode 100644 index e9e56e0ac..000000000 --- a/legacy/mekanism.client.nei/ChanceMachineRecipeHandler.java +++ /dev/null @@ -1,195 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawString; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Rectangle; -import java.util.Collection; - -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.recipe.machines.ChanceMachineRecipe; -import mekanism.common.recipe.outputs.ChanceOutput; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public abstract String getRecipeId(); - - public abstract Collection getRecipes(); - - public abstract ProgressBar getProgressType(); - - @Override - public void addGuiElements() - { - guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16)); - guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30)); - - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F; - } - }, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37)); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(12, 0, 28, 5, 144, 68); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -16, -5); - } - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.output.hasSecondary()) - { - drawString(Math.round(recipe.output.secondaryChance*100) + "%", 116, 52, 0x404040, false); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(63, 34, 24, 7), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(ChanceMachineRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(ChanceMachineRecipe irecipe : getRecipes()) - { - if(irecipe.getOutput().hasPrimary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().primaryOutput, result)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - else if(irecipe.getOutput().hasSecondary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().secondaryOutput, result)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiBasicMachine.png"; - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(ChanceMachineRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getInput().ingredient, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public PositionedStack input; - public ChanceOutput output; - - @Override - public PositionedStack getIngredient() - { - return input; - } - - @Override - public PositionedStack getResult() - { - if(output.hasPrimary()) - { - return new PositionedStack(output.primaryOutput, 100, 30); - } - - return null; - } - - @Override - public PositionedStack getOtherStack() - { - if(output.hasSecondary()) - { - return new PositionedStack(output.secondaryOutput, 116, 30); - } - - return null; - } - - public CachedIORecipe(ItemStack itemstack, ChanceOutput chance) - { - input = new PositionedStack(itemstack, 40, 12); - output = chance; - } - - public CachedIORecipe(ChanceMachineRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput()); - } - } -} diff --git a/legacy/mekanism.client.nei/ChemicalCrystallizerRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalCrystallizerRecipeHandler.java deleted file mode 100644 index 72821cc56..000000000 --- a/legacy/mekanism.client.nei/ChemicalCrystallizerRecipeHandler.java +++ /dev/null @@ -1,274 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiChemicalCrystallizer; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 3; - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.ChemicalCrystallizer.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "chemicalcrystallizer"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiChemicalCrystallizer.png"; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalCrystallizer.class; - } - - public String getRecipeId() - { - return "mekanism.chemicalcrystallizer"; - } - - public Collection getRecipes() - { - return Recipe.CHEMICAL_CRYSTALLIZER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 147, 79); - } - - @Override - public void drawExtras(int i) - { - GasStack gas = ((CachedIORecipe)arecipes.get(i)).inputStack; - - float f = ticksPassed % 20 / 20.0F; - drawProgressBar(53-xOffset, 61-yOffset, 176, 63, 48, 8, f, 0); - - if(gas != null) - { - displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, gas); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(53-xOffset, 61-yOffset, 48, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(CrystallizerRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(CrystallizerRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - - if(stack != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - - if(stack != null) - { - if(button == 0) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(CrystallizerRecipe irecipe : getRecipes()) - { - if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public GasStack inputStack; - public PositionedStack outputStack; - - @Override - public PositionedStack getResult() - { - return outputStack; - } - - public CachedIORecipe(GasStack input, ItemStack output) - { - inputStack = input; - outputStack = new PositionedStack(output, 131-xOffset, 57-yOffset); - } - - public CachedIORecipe(CrystallizerRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/ChemicalDissolutionChamberRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalDissolutionChamberRecipeHandler.java deleted file mode 100644 index 2dc3b302f..000000000 --- a/legacy/mekanism.client.nei/ChemicalDissolutionChamberRecipeHandler.java +++ /dev/null @@ -1,287 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasRegistry; -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiChemicalDissolutionChamber; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 3; - - @Override - public String getRecipeName() - { - return LangUtils.localize("gui.chemicalDissolutionChamber.short"); - } - - @Override - public String getOverlayIdentifier() - { - return "chemicaldissolutionchamber"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiChemicalDissolutionChamber.png"; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalDissolutionChamber.class; - } - - public String getRecipeId() - { - return "mekanism.chemicaldissolutionchamber"; - } - - public Collection getRecipes() - { - return Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 79); - } - - @Override - public void drawExtras(int i) - { - GasStack gas = ((CachedIORecipe)arecipes.get(i)).outputStack; - - float f = ticksPassed % 20 / 20.0F; - drawProgressBar(64-xOffset, 40-yOffset, 176, 63, 48, 8, f, 0); - - displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); - - if(gas != null) - { - displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, gas); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(64-xOffset, 40-yOffset, 48, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(DissolutionRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(DissolutionRecipe irecipe : getRecipes()) - { - if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - currenttip.add(GasRegistry.getGas("sulfuricAcid").getLocalizedName()); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = new GasStack(GasRegistry.getGas("sulfuricAcid"), 1); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(stack != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = new GasStack(GasRegistry.getGas("sulfuricAcid"), 1); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(stack != null) - { - if(button == 0) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(DissolutionRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getInput().ingredient, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public PositionedStack inputStack; - public GasStack outputStack; - - @Override - public PositionedStack getIngredient() - { - return inputStack; - } - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(ItemStack input, GasStack output) - { - inputStack = new PositionedStack(input, 26-xOffset, 36-yOffset); - outputStack = output; - } - - public CachedIORecipe(DissolutionRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/ChemicalInfuserRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalInfuserRecipeHandler.java deleted file mode 100644 index f0040b32a..000000000 --- a/legacy/mekanism.client.nei/ChemicalInfuserRecipeHandler.java +++ /dev/null @@ -1,306 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiChemicalInfuser; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.ChemicalPairInput; -import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 3; - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.ChemicalInfuser.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "chemicalinfuser"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiChemicalInfuser.png"; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalInfuser.class; - } - - public String getRecipeId() - { - return "mekanism.chemicalinfuser"; - } - - public Collection getRecipes() - { - return Recipe.CHEMICAL_INFUSER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 80); - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - drawTexturedModalRect(47-xOffset, 39-yOffset, 176, 71, 28, 8); - drawTexturedModalRect(101-xOffset, 39-yOffset, 176, 63, 28, 8); - - if(recipe.chemicalInput.leftGas != null) - { - displayGauge(58, 26-xOffset, 14-yOffset, 176, 4, 58, null, recipe.chemicalInput.leftGas); - } - - if(recipe.outputStack != null) - { - displayGauge(58, 80-xOffset, 5-yOffset, 176, 4, 58, null, recipe.outputStack); - } - - if(recipe.chemicalInput.rightGas != null) - { - displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, recipe.chemicalInput.rightGas); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(47-xOffset, 39-yOffset, 28, 8), getRecipeId(), new Object[0])); - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(101-xOffset, 39-yOffset, 28, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(ChemicalInfuserRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(ChemicalInfuserRecipe irecipe : getRecipes()) - { - if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(ChemicalInfuserRecipe irecipe : getRecipes()) - { - if(irecipe.getInput().containsType((GasStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas)); - } - else if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack)); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas; - } - else if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas; - } - - if(stack != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack stack = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).chemicalInput.leftGas; - } - else if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5+13 && yAxis <= 63+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).chemicalInput.rightGas; - } - - if(stack != null) - { - if(button == 0) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public ChemicalPairInput chemicalInput; - public GasStack outputStack; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(ChemicalPairInput input, GasStack output) - { - chemicalInput = input; - outputStack = output; - } - - public CachedIORecipe(ChemicalInfuserRecipe recipe) - { - this(recipe.getInput(), recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/ChemicalInjectionChamberRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalInjectionChamberRecipeHandler.java deleted file mode 100644 index e94cb15cf..000000000 --- a/legacy/mekanism.client.nei/ChemicalInjectionChamberRecipeHandler.java +++ /dev/null @@ -1,95 +0,0 @@ -package mekanism.client.nei; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.util.ListUtils; -import mekanism.client.gui.GuiChemicalInjectionChamber; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.Tier.GasTankTier; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.InjectionRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("nei.chemicalInjectionChamber"); - } - - @Override - public String getRecipeId() - { - return "mekanism.chemicalinjectionchamber"; - } - - @Override - public String getOverlayIdentifier() - { - return "chemicalinjectionchamber"; - } - - @Override - public Collection getRecipes() - { - return Recipe.CHEMICAL_INJECTION_CHAMBER.get().values(); - } - - @Override - public List getFuelStacks(Gas gasType) - { - if(gasType == GasRegistry.getGas("sulfuricAcid")) - { - List fuels = new ArrayList(); - fuels.addAll(OreDictionary.getOres("dustSulfur")); - - for(GasTankTier tier : GasTankTier.values()) - { - fuels.add(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("sulfuricAcid"))); - } - - return fuels; - } - else if(gasType == GasRegistry.getGas("water")) - { - for(GasTankTier tier : GasTankTier.values()) - { - return ListUtils.asList(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("water"))); - } - } - else if(gasType == GasRegistry.getGas("hydrogenChloride")) - { - List fuels = new ArrayList(); - fuels.addAll(OreDictionary.getOres("dustSalt")); - - for(GasTankTier tier : GasTankTier.values()) - { - fuels.add(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("hydrogenChloride"))); - } - - return fuels; - } - - return new ArrayList(); - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.YELLOW; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalInjectionChamber.class; - } -} diff --git a/legacy/mekanism.client.nei/ChemicalOxidizerRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalOxidizerRecipeHandler.java deleted file mode 100644 index 6f5b877c5..000000000 --- a/legacy/mekanism.client.nei/ChemicalOxidizerRecipeHandler.java +++ /dev/null @@ -1,293 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiChemicalOxidizer; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiGasGauge; -import mekanism.client.gui.element.GuiGauge; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.OxidationRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public GuiGasGauge gasOutput; - - public static int xOffset = 5; - public static int yOffset = 12; - - @Override - public void addGuiElements() - { - guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13)); - - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 4).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 24).with(SlotOverlay.PLUS)); - - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F; - } - }, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39)); - } - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.ChemicalOxidizer.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "chemicaloxidizer"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiChemicalOxidizer.png"; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalOxidizer.class; - } - - public String getRecipeId() - { - return "mekanism.chemicaloxidizer"; - } - - public Collection getRecipes() - { - return Recipe.CHEMICAL_OXIDIZER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(0, 0, xOffset, yOffset, 147, 62); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.outputStack != null) - { - gasOutput.setDummyType(recipe.outputStack.getGas()); - gasOutput.renderScale(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(64-xOffset, 40-yOffset, 48, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(OxidationRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(OxidationRecipe irecipe : getRecipes()) - { - if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - if(xAxis >= 134-5 && xAxis <= 150-5 && yAxis >= 14-11 && yAxis <= 72-11) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - if(xAxis >= 134-5 && xAxis <= 150-5 && yAxis >= 14-11 && yAxis <= 72-11) - { - GasStack stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - if(xAxis >= 134-5 && xAxis <= 150-5 && yAxis >= 14-11 && yAxis <= 72-11) - { - GasStack stack = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - - if(button == 0) - { - if(doGasLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 2; - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(OxidationRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().ingredient, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public PositionedStack inputStack; - public GasStack outputStack; - - @Override - public PositionedStack getIngredient() - { - return inputStack; - } - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(ItemStack input, GasStack output) - { - inputStack = new PositionedStack(input, 26-xOffset, 36-yOffset); - outputStack = output; - } - - public CachedIORecipe(OxidationRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/ChemicalWasherRecipeHandler.java b/legacy/mekanism.client.nei/ChemicalWasherRecipeHandler.java deleted file mode 100644 index 808029516..000000000 --- a/legacy/mekanism.client.nei/ChemicalWasherRecipeHandler.java +++ /dev/null @@ -1,348 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiChemicalWasher; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.WasherRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ChemicalWasherRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 3; - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.ChemicalWasher.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "chemicalwasher"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiChemicalWasher.png"; - } - - @Override - public Class getGuiClass() - { - return GuiChemicalWasher.class; - } - - public String getRecipeId() - { - return "mekanism.chemicalwasher"; - } - - public Collection getRecipes() - { - return Recipe.CHEMICAL_WASHER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 70); - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - drawTexturedModalRect(61-xOffset, 39-yOffset, 176, 63, 55, 8); - - displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, new FluidStack(FluidRegistry.WATER, 1), null); - - if(recipe.outputStack != null) - { - displayGauge(58, 27-xOffset, 14-yOffset, 176, 4, 58, null, recipe.inputStack); - } - - if(recipe.inputStack != null) - { - displayGauge(58, 134-xOffset, 14-yOffset, 176, 4, 58, null, recipe.outputStack); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(61-xOffset, 39-yOffset, 55, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(WasherRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(WasherRecipe irecipe : getRecipes()) - { - if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) - { - if(((FluidStack)ingredients[0]).getFluid() == FluidRegistry.WATER) - { - for(WasherRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(WasherRecipe irecipe : getRecipes()) - { - if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - currenttip.add(FluidRegistry.WATER.getLocalizedName(null)); - } - else if(xAxis >= 27 && xAxis <= 43 && yAxis >= 14+13 && yAxis <= 72+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack)); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - fluid = new FluidStack(FluidRegistry.WATER, 1); - } - else if(xAxis >= 27 && xAxis <= 43 && yAxis >= 14+13 && yAxis <= 72+13) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(gas != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 5+13 && yAxis <= 63+13) - { - fluid = new FluidStack(FluidRegistry.WATER, 1); - } - else if(xAxis >= 27 && xAxis <= 43 && yAxis >= 14+13 && yAxis <= 72+13) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(gas != null) - { - if(button == 0) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(button == 0) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(button == 1) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public GasStack inputStack; - public GasStack outputStack; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(GasStack input, GasStack output) - { - inputStack = input; - outputStack = output; - } - - public CachedIORecipe(WasherRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/CombinerRecipeHandler.java b/legacy/mekanism.client.nei/CombinerRecipeHandler.java deleted file mode 100644 index c6e052620..000000000 --- a/legacy/mekanism.client.nei/CombinerRecipeHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package mekanism.client.nei; - -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.util.ListUtils; -import mekanism.client.gui.GuiCombiner; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.CombinerRecipe; -import mekanism.common.util.LangUtils; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; - -public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.Combiner.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.combiner"; - } - - @Override - public String getOverlayIdentifier() - { - return "combiner"; - } - - @Override - public Collection getRecipes() - { - return Recipe.COMBINER.get().values(); - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.STONE; - } - - @Override - public List getFuelStacks(Gas gasType) - { - return ListUtils.asList(new ItemStack(Blocks.cobblestone)); - } - - @Override - public Class getGuiClass() - { - return GuiCombiner.class; - } -} diff --git a/legacy/mekanism.client.nei/CrusherRecipeHandler.java b/legacy/mekanism.client.nei/CrusherRecipeHandler.java deleted file mode 100644 index 0b695e98a..000000000 --- a/legacy/mekanism.client.nei/CrusherRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.nei; - -import java.util.Collection; - -import mekanism.client.gui.GuiCrusher; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.CrusherRecipe; -import mekanism.common.util.LangUtils; - -public class CrusherRecipeHandler extends MachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.Crusher.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.crusher"; - } - - @Override - public String getOverlayIdentifier() - { - return "crusher"; - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.CRUSH; - } - - @Override - public Collection getRecipes() - { - return Recipe.CRUSHER.get().values(); - } - - @Override - public Class getGuiClass() - { - return GuiCrusher.class; - } -} diff --git a/legacy/mekanism.client.nei/ElectrolyticSeparatorRecipeHandler.java b/legacy/mekanism.client.nei/ElectrolyticSeparatorRecipeHandler.java deleted file mode 100644 index cb5a27450..000000000 --- a/legacy/mekanism.client.nei/ElectrolyticSeparatorRecipeHandler.java +++ /dev/null @@ -1,390 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiElectrolyticSeparator; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiFluidGauge; -import mekanism.client.gui.element.GuiGasGauge; -import mekanism.client.gui.element.GuiGauge; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.FluidInput; -import mekanism.common.recipe.machines.SeparatorRecipe; -import mekanism.common.recipe.outputs.ChemicalPairOutput; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public GuiFluidGauge fluidInput; - public GuiGasGauge leftGas; - public GuiGasGauge rightGas; - - public static int xOffset = 5; - public static int yOffset = 9; - - @Override - public void addGuiElements() - { - guiElements.add(fluidInput = GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10)); - guiElements.add(leftGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18)); - guiElements.add(rightGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18)); - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 25, 34)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 51)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 51)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 34).with(SlotOverlay.POWER)); - - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return 1; - } - }, ProgressBar.BI, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 78, 29)); - } - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.ElectrolyticSeparator.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "electrolyticseparator"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiElectrolyticSeparator.png"; - } - - @Override - public Class getGuiClass() - { - return GuiElectrolyticSeparator.class; - } - - public String getRecipeId() - { - return "mekanism.electrolyticseparator"; - } - - public Collection getRecipes() - { - return Recipe.ELECTROLYTIC_SEPARATOR.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-1, 0, 4, yOffset, 167, 62); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.fluidInput != null) - { - fluidInput.setDummyType(recipe.fluidInput.ingredient.getFluid()); - fluidInput.renderScale(0, 0, -xOffset, -yOffset); - } - - if(recipe.outputPair.leftGas != null) - { - displayGauge(28, 59-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.leftGas); - leftGas.setDummyType(recipe.outputPair.leftGas.getGas()); - leftGas.renderScale(0, 0, -xOffset, -yOffset); - } - - if(recipe.outputPair.rightGas != null) - { - displayGauge(28, 101-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.rightGas); - rightGas.setDummyType(recipe.outputPair.rightGas.getGas()); - rightGas.renderScale(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(80-xOffset, 30-yOffset, 16, 6), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(SeparatorRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(SeparatorRecipe irecipe : getRecipes()) - { - if(irecipe.recipeOutput.containsType((GasStack)results[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) - { - for(SeparatorRecipe irecipe : getRecipes()) - { - if(irecipe.recipeInput.ingredient.isFluidEqual((FluidStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7) - { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient)); - } - else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) - { - currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas.getGas().getLocalizedName()); - } - else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) - { - currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas.getGas().getLocalizedName()); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient; - } - else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas; - } - else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas; - } - - if(gas != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient; - } - else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas; - } - else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas; - } - - if(gas != null) - { - if(button == 0) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(button == 0) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(button == 1) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public FluidInput fluidInput; - public ChemicalPairOutput outputPair; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(FluidInput input, ChemicalPairOutput pair) - { - fluidInput = input; - outputPair = pair; - } - - public CachedIORecipe(SeparatorRecipe recipe) - { - this(recipe.recipeInput, recipe.recipeOutput); - } - } -} diff --git a/legacy/mekanism.client.nei/ElementBoundHandler.java b/legacy/mekanism.client.nei/ElementBoundHandler.java deleted file mode 100644 index e0b455704..000000000 --- a/legacy/mekanism.client.nei/ElementBoundHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package mekanism.client.nei; - -import mekanism.client.gui.GuiMekanism; -import mekanism.client.gui.element.GuiElement; -import net.minecraft.client.gui.inventory.GuiContainer; -import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.api.INEIGuiAdapter; - -public class ElementBoundHandler extends INEIGuiAdapter -{ - @Override - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int width, int height) - { - if(gui instanceof GuiMekanism) - { - GuiMekanism guiMek = (GuiMekanism)gui; - - Rectangle4i rect = new Rectangle4i(x, y, width, height); - - for(GuiElement element : guiMek.guiElements) - { - if(element.getBounds(guiMek.getXPos(), guiMek.getYPos()).intersects(rect)) - { - return true; - } - } - } - - return false; - } -} diff --git a/legacy/mekanism.client.nei/EnrichmentChamberRecipeHandler.java b/legacy/mekanism.client.nei/EnrichmentChamberRecipeHandler.java deleted file mode 100644 index f32986f6b..000000000 --- a/legacy/mekanism.client.nei/EnrichmentChamberRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.nei; - -import java.util.Collection; - -import mekanism.client.gui.GuiEnrichmentChamber; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.EnrichmentRecipe; -import mekanism.common.util.LangUtils; - -public class EnrichmentChamberRecipeHandler extends MachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.EnrichmentChamber.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.chamber"; - } - - @Override - public String getOverlayIdentifier() - { - return "chamber"; - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.BLUE; - } - - @Override - public Collection getRecipes() - { - return Recipe.ENRICHMENT_CHAMBER.get().values(); - } - - @Override - public Class getGuiClass() - { - return GuiEnrichmentChamber.class; - } -} diff --git a/legacy/mekanism.client.nei/MachineRecipeHandler.java b/legacy/mekanism.client.nei/MachineRecipeHandler.java deleted file mode 100644 index d9551fae2..000000000 --- a/legacy/mekanism.client.nei/MachineRecipeHandler.java +++ /dev/null @@ -1,164 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Rectangle; -import java.util.Collection; - -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.recipe.machines.BasicMachineRecipe; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public abstract class MachineRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public abstract String getRecipeId(); - - public abstract Collection getRecipes(); - - public abstract ProgressBar getProgressType(); - - @Override - public void addGuiElements() - { - guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 16)); - guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55, 52).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 111, 30)); - - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F; - } - }, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37)); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(12, 0, 28, 5, 144, 68); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -16, -5); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(63, 34, 24, 7), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(BasicMachineRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(BasicMachineRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiBasicMachine.png"; - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(BasicMachineRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().ingredient, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public PositionedStack input; - public PositionedStack output; - - @Override - public PositionedStack getIngredient() - { - return input; - } - - @Override - public PositionedStack getResult() - { - return output; - } - - public CachedIORecipe(ItemStack itemstack, ItemStack itemstack1) - { - super(); - - input = new PositionedStack(itemstack, 40, 12); - output = new PositionedStack(itemstack1, 100, 30); - } - - public CachedIORecipe(BasicMachineRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/MekanismSlotClickHandler.java b/legacy/mekanism.client.nei/MekanismSlotClickHandler.java deleted file mode 100644 index 229831a5b..000000000 --- a/legacy/mekanism.client.nei/MekanismSlotClickHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package mekanism.client.nei; - -import mekanism.client.gui.GuiMekanism; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; -import codechicken.nei.guihook.IContainerSlotClickHandler; - -public class MekanismSlotClickHandler implements IContainerSlotClickHandler -{ - @Override - public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) - { - - } - - @Override - public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier, boolean eventconsumed) - { - if(gui instanceof GuiMekanism) - { - ((GuiMekanism)gui).handleMouse(slot, slotIndex, button, modifier); - return true; - } - - return false; - } - - @Override - public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) - { - - } -} diff --git a/legacy/mekanism.client.nei/MetallurgicInfuserRecipeHandler.java b/legacy/mekanism.client.nei/MetallurgicInfuserRecipeHandler.java deleted file mode 100644 index f8053382e..000000000 --- a/legacy/mekanism.client.nei/MetallurgicInfuserRecipeHandler.java +++ /dev/null @@ -1,257 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import mekanism.api.infuse.InfuseObject; -import mekanism.api.infuse.InfuseRegistry; -import mekanism.api.infuse.InfuseType; -import mekanism.client.gui.GuiMetallurgicInfuser; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.client.render.MekanismRenderer; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - @Override - public void addGuiElements() - { - guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 16, 34)); - guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 50, 42)); - guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 142, 34).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 108, 42)); - - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - guiElements.add(new GuiProgress(new IProgressInfoHandler() { - @Override - public double getProgress() - { - return ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F; - } - }, ProgressBar.MEDIUM, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 70, 46)); - } - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.MetallurgicInfuser.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "infuser"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/GuiMetallurgicInfuser.png"; - } - - @Override - public Class getGuiClass() - { - return GuiMetallurgicInfuser.class; - } - - public String getRecipeId() - { - return "mekanism.infuser"; - } - - public List getInfuseStacks(InfuseType type) - { - List ret = new ArrayList(); - - for(Map.Entry obj : InfuseRegistry.getObjectMap().entrySet()) - { - if(obj.getValue().type == type) - { - ret.add(obj.getKey()); - } - } - - return ret; - } - - public Collection getRecipes() - { - return Recipe.METALLURGIC_INFUSER.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(0, 0, 5, 15, 166, 56); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -5, -15); - } - } - - @Override - public void drawExtras(int i) - { - InfuseType type = ((CachedIORecipe)arecipes.get(i)).infusionType; - - float f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F; - if(ticksPassed < 20) f = 0.0F; - - int display = (int)(52F*f); - changeTexture(MekanismRenderer.getBlocksTexture()); - drawTexturedRectFromIcon(2, 2+52-display, type.icon, 4, display); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(67, 32, 32, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(MetallurgicInfuserRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe, getInfuseStacks(irecipe.getInput().infuse.type), irecipe.getInput().infuse.type)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public int recipiesPerPage() - { - return 2; - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(MetallurgicInfuserRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result)) - { - arecipes.add(new CachedIORecipe(irecipe, getInfuseStacks(irecipe.getInput().infuse.type), irecipe.getInput().infuse.type)); - } - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(MetallurgicInfuserRecipe irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().inputStack, ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe, getInfuseStacks(irecipe.getInput().infuse.type), irecipe.getInput().infuse.type)); - } - - List infuses; - - for(ItemStack stack : getInfuseStacks(irecipe.getInput().infuse.type)) - { - if(NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) - { - infuses = new ArrayList(); - infuses.add(stack); - arecipes.add(new CachedIORecipe(irecipe, infuses, irecipe.getInput().infuse.type)); - } - } - } - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public List infuseStacks; - - public PositionedStack inputStack; - public PositionedStack outputStack; - - public InfuseType infusionType; - - @Override - public PositionedStack getIngredient() - { - return inputStack; - } - - @Override - public PositionedStack getResult() - { - return outputStack; - } - - @Override - public PositionedStack getOtherStack() - { - return new PositionedStack(infuseStacks.get(cycleticks/40 % infuseStacks.size()), 12, 20); - } - - public CachedIORecipe(ItemStack input, ItemStack output, List infuses, InfuseType type) - { - super(); - - inputStack = new PositionedStack(input, 46, 28); - outputStack = new PositionedStack(output, 104, 28); - - infuseStacks = infuses; - - infusionType = type; - } - - public CachedIORecipe(MetallurgicInfuserRecipe recipe, List infuses, InfuseType type) - { - this(recipe.getInput().inputStack, recipe.getOutput().output, infuses, type); - } - } -} diff --git a/legacy/mekanism.client.nei/NEIMekanismConfig.java b/legacy/mekanism.client.nei/NEIMekanismConfig.java deleted file mode 100644 index cecb68de5..000000000 --- a/legacy/mekanism.client.nei/NEIMekanismConfig.java +++ /dev/null @@ -1,132 +0,0 @@ -package mekanism.client.nei; - -import mekanism.client.gui.GuiChemicalCrystallizer; -import mekanism.client.gui.GuiChemicalDissolutionChamber; -import mekanism.client.gui.GuiChemicalInfuser; -import mekanism.client.gui.GuiChemicalInjectionChamber; -import mekanism.client.gui.GuiChemicalOxidizer; -import mekanism.client.gui.GuiChemicalWasher; -import mekanism.client.gui.GuiCombiner; -import mekanism.client.gui.GuiCrusher; -import mekanism.client.gui.GuiElectrolyticSeparator; -import mekanism.client.gui.GuiEnrichmentChamber; -import mekanism.client.gui.GuiMetallurgicInfuser; -import mekanism.client.gui.GuiOsmiumCompressor; -import mekanism.client.gui.GuiPRC; -import mekanism.client.gui.GuiPrecisionSawmill; -import mekanism.client.gui.GuiPurificationChamber; -import mekanism.client.gui.GuiRotaryCondensentrator; -import mekanism.client.gui.GuiSolarNeutronActivator; -import mekanism.client.gui.GuiThermalEvaporationController; -import mekanism.common.MekanismBlocks; -import mekanism.common.MekanismItems; -import net.minecraft.item.ItemStack; -import codechicken.nei.api.API; -import codechicken.nei.api.IConfigureNEI; -import codechicken.nei.guihook.GuiContainerManager; - -public class NEIMekanismConfig implements IConfigureNEI -{ - @Override - public void loadConfig() - { - API.registerRecipeHandler(new EnrichmentChamberRecipeHandler()); - API.registerUsageHandler(new EnrichmentChamberRecipeHandler()); - - API.registerRecipeHandler(new OsmiumCompressorRecipeHandler()); - API.registerUsageHandler(new OsmiumCompressorRecipeHandler()); - - API.registerRecipeHandler(new CrusherRecipeHandler()); - API.registerUsageHandler(new CrusherRecipeHandler()); - - API.registerRecipeHandler(new CombinerRecipeHandler()); - API.registerUsageHandler(new CombinerRecipeHandler()); - - API.registerRecipeHandler(new MetallurgicInfuserRecipeHandler()); - API.registerUsageHandler(new MetallurgicInfuserRecipeHandler()); - - API.registerRecipeHandler(new PurificationChamberRecipeHandler()); - API.registerUsageHandler(new PurificationChamberRecipeHandler()); - - API.registerRecipeHandler(new ChemicalInjectionChamberRecipeHandler()); - API.registerUsageHandler(new ChemicalInjectionChamberRecipeHandler()); - - API.registerRecipeHandler(new ChemicalOxidizerRecipeHandler()); - API.registerUsageHandler(new ChemicalOxidizerRecipeHandler()); - - API.registerRecipeHandler(new ChemicalInfuserRecipeHandler()); - API.registerUsageHandler(new ChemicalInfuserRecipeHandler()); - - API.registerRecipeHandler(new RotaryCondensentratorRecipeHandler()); - API.registerUsageHandler(new RotaryCondensentratorRecipeHandler()); - - API.registerRecipeHandler(new ElectrolyticSeparatorRecipeHandler()); - API.registerUsageHandler(new ElectrolyticSeparatorRecipeHandler()); - - API.registerRecipeHandler(new PrecisionSawmillRecipeHandler()); - API.registerUsageHandler(new PrecisionSawmillRecipeHandler()); - - API.registerRecipeHandler(new ThermalEvaporationRecipeHandler()); - API.registerUsageHandler(new ThermalEvaporationRecipeHandler()); - - API.registerRecipeHandler(new ChemicalDissolutionChamberRecipeHandler()); - API.registerUsageHandler(new ChemicalDissolutionChamberRecipeHandler()); - - API.registerRecipeHandler(new ChemicalWasherRecipeHandler()); - API.registerUsageHandler(new ChemicalWasherRecipeHandler()); - - API.registerRecipeHandler(new ChemicalCrystallizerRecipeHandler()); - API.registerUsageHandler(new ChemicalCrystallizerRecipeHandler()); - - API.registerRecipeHandler(new PRCRecipeHandler()); - API.registerUsageHandler(new PRCRecipeHandler()); - - API.registerRecipeHandler(new SolarNeutronRecipeHandler()); - API.registerUsageHandler(new SolarNeutronRecipeHandler()); - - API.registerRecipeHandler(new ShapedMekanismRecipeHandler()); - API.registerUsageHandler(new ShapedMekanismRecipeHandler()); - - API.registerRecipeHandler(new ShapelessMekanismRecipeHandler()); - API.registerUsageHandler(new ShapelessMekanismRecipeHandler()); - - API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6); - API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6); - API.setGuiOffset(GuiCrusher.class, 16, 6); - API.setGuiOffset(GuiCombiner.class, 16, 6); - API.setGuiOffset(GuiPurificationChamber.class, 16, 6); - API.setGuiOffset(GuiChemicalInjectionChamber.class, 16, 6); - API.setGuiOffset(GuiMetallurgicInfuser.class, 5, 15); - API.setGuiOffset(GuiChemicalOxidizer.class, ChemicalOxidizerRecipeHandler.xOffset, ChemicalOxidizerRecipeHandler.yOffset); - API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset); - API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset); - API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset); - API.setGuiOffset(GuiPrecisionSawmill.class, 16, 6); - API.setGuiOffset(GuiThermalEvaporationController.class, ThermalEvaporationRecipeHandler.xOffset, ThermalEvaporationRecipeHandler.yOffset); - API.setGuiOffset(GuiChemicalDissolutionChamber.class, ChemicalDissolutionChamberRecipeHandler.xOffset, ChemicalDissolutionChamberRecipeHandler.yOffset); - API.setGuiOffset(GuiChemicalWasher.class, ChemicalWasherRecipeHandler.xOffset, ChemicalWasherRecipeHandler.yOffset); - API.setGuiOffset(GuiChemicalCrystallizer.class, ChemicalCrystallizerRecipeHandler.xOffset, ChemicalCrystallizerRecipeHandler.yOffset); - API.setGuiOffset(GuiPRC.class, PRCRecipeHandler.xOffset, PRCRecipeHandler.yOffset); - API.setGuiOffset(GuiThermalEvaporationController.class, ThermalEvaporationRecipeHandler.xOffset, ThermalEvaporationRecipeHandler.yOffset); - API.setGuiOffset(GuiSolarNeutronActivator.class, SolarNeutronRecipeHandler.xOffset, SolarNeutronRecipeHandler.yOffset); - - GuiContainerManager.addSlotClickHandler(new MekanismSlotClickHandler()); - - API.registerNEIGuiHandler(new ElementBoundHandler()); - - API.hideItem(new ItemStack(MekanismBlocks.BoundingBlock)); - API.hideItem(new ItemStack(MekanismItems.ItemProxy)); - } - - @Override - public String getName() - { - return "Mekanism NEI Plugin"; - } - - @Override - public String getVersion() - { - return "8.0.0"; - } -} diff --git a/legacy/mekanism.client.nei/OsmiumCompressorRecipeHandler.java b/legacy/mekanism.client.nei/OsmiumCompressorRecipeHandler.java deleted file mode 100644 index 2b6fb30a6..000000000 --- a/legacy/mekanism.client.nei/OsmiumCompressorRecipeHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package mekanism.client.nei; - -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.util.ListUtils; -import mekanism.client.gui.GuiOsmiumCompressor; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.MekanismItems; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.OsmiumCompressorRecipe; -import mekanism.common.util.LangUtils; -import net.minecraft.item.ItemStack; - -public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.OsmiumCompressor.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.compressor"; - } - - @Override - public String getOverlayIdentifier() - { - return "compressor"; - } - - @Override - public Collection getRecipes() - { - return Recipe.OSMIUM_COMPRESSOR.get().values(); - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.RED; - } - - @Override - public List getFuelStacks(Gas gasType) - { - return ListUtils.asList(new ItemStack(MekanismItems.Ingot, 1, 1)); - } - - @Override - public Class getGuiClass() - { - return GuiOsmiumCompressor.class; - } -} diff --git a/legacy/mekanism.client.nei/PRCRecipeHandler.java b/legacy/mekanism.client.nei/PRCRecipeHandler.java deleted file mode 100644 index 4dbb1484b..000000000 --- a/legacy/mekanism.client.nei/PRCRecipeHandler.java +++ /dev/null @@ -1,443 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiPRC; -import mekanism.client.gui.element.GuiElement; -import mekanism.client.gui.element.GuiFluidGauge; -import mekanism.client.gui.element.GuiGasGauge; -import mekanism.client.gui.element.GuiGauge; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; -import mekanism.client.gui.element.GuiProgress; -import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.inputs.PressurizedInput; -import mekanism.common.recipe.machines.PressurizedRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class PRCRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public GuiFluidGauge fluidInput; - public GuiGasGauge gasInput; - public GuiGasGauge gasOutput; - - public static int xOffset = 5; - public static int yOffset = 11; - - @Override - public void addGuiElements() - { - guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 53, 34)); - guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 140, 18).with(SlotOverlay.POWER)); - guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 115, 34)); - - guiElements.add(fluidInput = GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 5, 10)); - guiElements.add(gasInput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 28, 10)); - guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 140, 40)); - - guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { - @Override - public double getLevel() - { - return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - } - }, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15)); - guiElements.add(new GuiProgress(new IProgressInfoHandler() - { - @Override - public double getProgress() - { - return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F; - } - }, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 75, 37)); - } - - public ProgressBar getProgressType() - { - return ProgressBar.MEDIUM; - } - - public Set> getRecipes() - { - return Recipe.PRESSURIZED_REACTION_CHAMBER.get().entrySet(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 68); - - for(GuiElement e : guiElements) - { - e.renderBackground(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(75-xOffset, 37-yOffset, 36, 10), getRecipeId(), new Object[0])); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - ticksPassed++; - } - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.PressurizedReactionChamber.short.name"); - } - - @Override - public Class getGuiClass() - { - return GuiPRC.class; - } - - @Override - public String getOverlayIdentifier() - { - return "prc"; - } - - @Override - public int recipiesPerPage() - { - return 2; - } - - public String getRecipeId() - { - return "mekanism.prc"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiPRC.png"; - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.pressurizedRecipe.getInput().getFluid() != null) - { - fluidInput.setDummyType(recipe.pressurizedRecipe.getInput().getFluid().getFluid()); - fluidInput.renderScale(0, 0, -xOffset, -yOffset); - } - - if(recipe.pressurizedRecipe.getInput().getGas() != null) - { - gasInput.setDummyType(recipe.pressurizedRecipe.getInput().getGas().getGas()); - gasInput.renderScale(0, 0, -xOffset, -yOffset); - } - - if(recipe.pressurizedRecipe.getOutput().getGasOutput() != null) - { - gasOutput.setDummyType(recipe.pressurizedRecipe.getOutput().getGasOutput().getGas()); - gasOutput.renderScale(0, 0, -xOffset, -yOffset); - } - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(Map.Entry irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(Map.Entry irecipe : getRecipes()) - { - if(irecipe.getValue().getOutput().getGasOutput().isGasEqual((GasStack)results[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - for(Map.Entry irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().getOutput().getItemOutput(), result)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(Map.Entry irecipe : getRecipes()) - { - if(irecipe.getKey().containsType((GasStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) - { - for(Map.Entry irecipe : getRecipes()) - { - if(irecipe.getKey().containsType((FluidStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - for(Map.Entry irecipe : getRecipes()) - { - if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getKey().getSolid(), ingredient)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid())); - } - else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas())); - } - else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput())); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid(); - } - else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas(); - } - else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput(); - } - - if(gas != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - Point offset = gui.getRecipePosition(recipe); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid(); - } - else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas(); - } - else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput(); - } - - if(gas != null) - { - if(button == 0) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(button == 0) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(button == 1) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public PressurizedRecipe pressurizedRecipe; - - public PositionedStack input; - public PositionedStack output; - - @Override - public PositionedStack getIngredient() - { - return input; - } - - @Override - public PositionedStack getResult() - { - return output; - } - - public CachedIORecipe(PressurizedRecipe recipe) - { - super(); - - pressurizedRecipe = recipe; - - input = new PositionedStack(recipe.getInput().getSolid(), 54-xOffset, 35-yOffset); - output = new PositionedStack(recipe.getOutput().getItemOutput(), 116-xOffset, 35-yOffset); - } - - public CachedIORecipe(Map.Entry recipe) - { - this((PressurizedRecipe)recipe.getValue()); - } - } -} diff --git a/legacy/mekanism.client.nei/PrecisionSawmillRecipeHandler.java b/legacy/mekanism.client.nei/PrecisionSawmillRecipeHandler.java deleted file mode 100644 index 9d3442119..000000000 --- a/legacy/mekanism.client.nei/PrecisionSawmillRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.nei; - -import java.util.Collection; - -import mekanism.client.gui.GuiPrecisionSawmill; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.SawmillRecipe; -import mekanism.common.util.LangUtils; - -public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock2.PrecisionSawmill.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.precisionsawmill"; - } - - @Override - public String getOverlayIdentifier() - { - return "precisionsawmill"; - } - - @Override - public Collection getRecipes() - { - return Recipe.PRECISION_SAWMILL.get().values(); - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.PURPLE; - } - - @Override - public Class getGuiClass() - { - return GuiPrecisionSawmill.class; - } -} diff --git a/legacy/mekanism.client.nei/PurificationChamberRecipeHandler.java b/legacy/mekanism.client.nei/PurificationChamberRecipeHandler.java deleted file mode 100644 index db1e61bca..000000000 --- a/legacy/mekanism.client.nei/PurificationChamberRecipeHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -package mekanism.client.nei; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.util.ListUtils; -import mekanism.client.gui.GuiPurificationChamber; -import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.Tier.GasTankTier; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.PurificationRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandler -{ - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock.PurificationChamber.name"); - } - - @Override - public String getRecipeId() - { - return "mekanism.purificationchamber"; - } - - @Override - public String getOverlayIdentifier() - { - return "purificationchamber"; - } - - @Override - public Collection getRecipes() - { - return Recipe.PURIFICATION_CHAMBER.get().values(); - } - - @Override - public ProgressBar getProgressType() - { - return ProgressBar.RED; - } - - @Override - public List getFuelStacks(Gas gasType) - { - if(gasType == GasRegistry.getGas("oxygen")) - { - for(GasTankTier tier : GasTankTier.values()) - { - return ListUtils.asList(new ItemStack(Items.flint), MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("oxygen"))); - } - } - - return new ArrayList(); - } - - @Override - public Class getGuiClass() - { - return GuiPurificationChamber.class; - } -} diff --git a/legacy/mekanism.client.nei/RotaryCondensentratorRecipeHandler.java b/legacy/mekanism.client.nei/RotaryCondensentratorRecipeHandler.java deleted file mode 100644 index 03afb2ae3..000000000 --- a/legacy/mekanism.client.nei/RotaryCondensentratorRecipeHandler.java +++ /dev/null @@ -1,347 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawString; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.List; - -import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiRotaryCondensentrator; -import mekanism.common.ObfuscatedNames; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 12; - - @Override - public String getRecipeName() - { - return LangUtils.localize("nei.rotaryCondensentrator"); - } - - @Override - public String getOverlayIdentifier() - { - return "rotarycondensentrator"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiRotaryCondensentrator.png"; - } - - @Override - public Class getGuiClass() - { - return GuiRotaryCondensentrator.class; - } - - public String getRecipeId() - { - return "mekanism.rotarycondensentrator"; - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 71); - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - if(recipe.type) - { - drawTexturedModalRect(64-xOffset, 39-yOffset, 176, 123, 48, 8); - } - else { - drawTexturedModalRect(64-xOffset, 39-yOffset, 176, 115, 48, 8); - } - - if(recipe.gasStack != null) - { - displayGauge(58, 26-xOffset, 14-yOffset, 176, 40, 58, null, recipe.gasStack); - } - - if(recipe.fluidStack != null) - { - displayGauge(58, 134-xOffset, 14-yOffset, 176, 40, 58, recipe.fluidStack, null); - } - - drawString(recipe.type ? LangUtils.localize("gui.condensentrating") : LangUtils.localize("gui.decondensentrating"), 6-xOffset, 74-yOffset, 0x404040, false); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(64-xOffset, 39-yOffset, 48, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(Gas gas : GasRegistry.getRegisteredGasses()) - { - if(gas.hasFluid()) - { - arecipes.add(new CachedIORecipe(new GasStack(gas, 1), new FluidStack(gas.getFluid(), 1), true)); - arecipes.add(new CachedIORecipe(new GasStack(gas, 1), new FluidStack(gas.getFluid(), 1), false)); - } - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - GasStack gas = (GasStack)results[0]; - - if(gas.getGas().hasFluid()) - { - arecipes.add(new CachedIORecipe(new GasStack(gas.getGas(), 1), new FluidStack(gas.getGas().getFluid(), 1), false)); - } - } - else if(outputId.equals("fluid") && results.length == 1 && results[0] instanceof FluidStack) - { - FluidStack fluid = (FluidStack)results[0]; - Gas gas = GasRegistry.getGas(fluid.getFluid()); - - if(gas != null) - { - arecipes.add(new CachedIORecipe(new GasStack(gas, 1), new FluidStack(fluid.getFluid(), 1), true)); - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - GasStack gas = (GasStack)ingredients[0]; - - if(gas.getGas().hasFluid()) - { - arecipes.add(new CachedIORecipe(new GasStack(gas.getGas(), 1), new FluidStack(gas.getGas().getFluid(), 1), true)); - } - } - else if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) - { - FluidStack fluid = (FluidStack)ingredients[0]; - Gas gas = GasRegistry.getGas(fluid.getFluid()); - - if(gas != null) - { - arecipes.add(new CachedIORecipe(new GasStack(gas, 1), new FluidStack(fluid.getFluid(), 1), false)); - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).gasStack)); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).gasStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack; - } - - if(gas != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - FluidStack fluid = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+18 && yAxis <= 72+18) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).gasStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+18 && yAxis <= 72+18) - { - fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack; - } - - if(gas != null) - { - if(button == 0) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - else if(fluid != null) - { - if(button == 0) - { - if(doFluidLookup(fluid, false)) - { - return true; - } - } - else if(button == 1) - { - if(doFluidLookup(fluid, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public GasStack gasStack; - public FluidStack fluidStack; - - /* true = condensentrating, false = decondensentrating */ - public boolean type; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(GasStack gas, FluidStack fluid, boolean b) - { - gasStack = gas; - fluidStack = fluid; - type = b; - } - } -} diff --git a/legacy/mekanism.client.nei/ShapedMekanismRecipeHandler.java b/legacy/mekanism.client.nei/ShapedMekanismRecipeHandler.java deleted file mode 100644 index 0c87a628a..000000000 --- a/legacy/mekanism.client.nei/ShapedMekanismRecipeHandler.java +++ /dev/null @@ -1,156 +0,0 @@ -package mekanism.client.nei; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import mekanism.common.recipe.ShapedMekanismRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.RecipeUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.ShapedRecipeHandler; - -public class ShapedMekanismRecipeHandler extends ShapedRecipeHandler -{ - @Override - public String getRecipeName() - { - return "Mekanism " + LangUtils.localize("recipe.mekanismShaped"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals("crafting") && getClass() == ShapedMekanismRecipeHandler.class) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapedMekanismRecipe) - { - ShapedMekanismRecipe mekanismRecipe = (ShapedMekanismRecipe)irecipe; - CachedShapedMekanismRecipe recipe = new CachedShapedMekanismRecipe(mekanismRecipe); - - recipe.computeVisuals(); - arecipes.add(recipe); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapedMekanismRecipe && RecipeUtils.areItemsEqualForCrafting(irecipe.getRecipeOutput(), result)) - { - ShapedMekanismRecipe mekanismRecipe = (ShapedMekanismRecipe)irecipe; - CachedShapedMekanismRecipe recipe = new CachedShapedMekanismRecipe(mekanismRecipe); - - recipe.computeVisuals(); - arecipes.add(recipe); - } - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapedMekanismRecipe) - { - ShapedMekanismRecipe mekanismRecipe = (ShapedMekanismRecipe)irecipe; - CachedShapedMekanismRecipe recipe = new CachedShapedMekanismRecipe(mekanismRecipe); - - recipe.computeVisuals(); - - if(recipe.contains(recipe.ingredients, ingredient)) - { - recipe.setIngredientPermutation(recipe.ingredients, ingredient); - arecipes.add(recipe); - } - } - } - } - - public class CachedShapedMekanismRecipe extends CachedRecipe - { - public ArrayList ingredients; - public PositionedStack result; - - public CachedShapedMekanismRecipe(ShapedMekanismRecipe recipe) - { - result = new PositionedStack(recipe.getRecipeOutput(), 119, 24); - ingredients = new ArrayList(); - setIngredients(recipe.width, recipe.height, recipe.getInput()); - } - - public void setIngredients(int width, int height, Object[] items) - { - for(int x = 0; x < width; x++) - { - for(int y = 0; y < height; y++) - { - if(items[y*width+x] == null) - { - continue; - } - - PositionedStack stack = new PositionedStack(items[y*width+x], 25+x*18, 6+y*18); - stack.setMaxSize(1); - ingredients.add(stack); - } - } - } - - @Override - public List getIngredients() - { - return getCycledIngredients(cycleticks / 20, ingredients); - } - - @Override - public PositionedStack getResult() - { - return result; - } - - public void computeVisuals() - { - for(PositionedStack p : ingredients) - { - p.generatePermutations(); - } - } - - @Override - public boolean contains(Collection ingredients, ItemStack ingredient) - { - for(PositionedStack stack : ingredients) - { - for(ItemStack item : stack.items) - { - if(RecipeUtils.areItemsEqualForCrafting(item, ingredient)) - { - return true; - } - } - } - - return false; - } - } -} diff --git a/legacy/mekanism.client.nei/ShapelessMekanismRecipeHandler.java b/legacy/mekanism.client.nei/ShapelessMekanismRecipeHandler.java deleted file mode 100644 index f3cecc9a5..000000000 --- a/legacy/mekanism.client.nei/ShapelessMekanismRecipeHandler.java +++ /dev/null @@ -1,125 +0,0 @@ -package mekanism.client.nei; - -import java.util.ArrayList; -import java.util.List; - -import mekanism.common.recipe.ShapelessMekanismRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.RecipeUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.ShapelessRecipeHandler; - -public class ShapelessMekanismRecipeHandler extends ShapelessRecipeHandler -{ - @Override - public String getRecipeName() - { - return "Mekanism " + LangUtils.localize("recipe.mekanismShapeless"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals("crafting") && getClass() == ShapelessMekanismRecipeHandler.class) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapelessMekanismRecipe) - { - ShapelessMekanismRecipe mekanismRecipe = (ShapelessMekanismRecipe)irecipe; - CachedShapelessMekanismRecipe recipe = new CachedShapelessMekanismRecipe(mekanismRecipe); - - arecipes.add(recipe); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapelessMekanismRecipe && RecipeUtils.areItemsEqualForCrafting(irecipe.getRecipeOutput(), result)) - { - ShapelessMekanismRecipe mekanismRecipe = (ShapelessMekanismRecipe)irecipe; - CachedShapelessMekanismRecipe recipe = new CachedShapelessMekanismRecipe(mekanismRecipe); - - arecipes.add(recipe); - } - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) - { - List allrecipes = CraftingManager.getInstance().getRecipeList(); - - for(IRecipe irecipe : allrecipes) - { - if(irecipe instanceof ShapelessMekanismRecipe) - { - ShapelessMekanismRecipe mekanismRecipe = (ShapelessMekanismRecipe)irecipe; - CachedShapelessMekanismRecipe recipe = new CachedShapelessMekanismRecipe(mekanismRecipe); - - if(recipe.contains(recipe.ingredients, ingredient)) - { - recipe.setIngredientPermutation(recipe.ingredients, ingredient); - arecipes.add(recipe); - } - } - } - } - - public class CachedShapelessMekanismRecipe extends CachedRecipe - { - public ArrayList ingredients; - public PositionedStack result; - - public CachedShapelessMekanismRecipe(ShapelessMekanismRecipe recipe) - { - result = new PositionedStack(recipe.getRecipeOutput(), 119, 24); - ingredients = new ArrayList(); - setIngredients(recipe.getInput()); - } - - public void setIngredients(List items) - { - ingredients.clear(); - - for(int x = 0; x < items.size(); x++) - { - PositionedStack stack = new PositionedStack(items.get(x), 25 + stackorder[x][0] * 18, 6 + stackorder[x][1] * 18); - stack.setMaxSize(1); - ingredients.add(stack); - } - } - - public void setResult(ItemStack output) - { - result = new PositionedStack(output, 119, 24); - } - - @Override - public List getIngredients() - { - return getCycledIngredients(cycleticks / 20, ingredients); - } - - @Override - public PositionedStack getResult() - { - return result; - } - } -} diff --git a/legacy/mekanism.client.nei/SolarNeutronRecipeHandler.java b/legacy/mekanism.client.nei/SolarNeutronRecipeHandler.java deleted file mode 100644 index f7d2b88c2..000000000 --- a/legacy/mekanism.client.nei/SolarNeutronRecipeHandler.java +++ /dev/null @@ -1,286 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.api.gas.GasStack; -import mekanism.client.gui.GuiSolarNeutronActivator; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.SolarNeutronRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class SolarNeutronRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 12; - - @Override - public String getRecipeName() - { - return LangUtils.localize("tile.MachineBlock3.SolarNeutronActivator.name"); - } - - @Override - public String getOverlayIdentifier() - { - return "solarneutron"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiSolarNeutronActivator.png"; - } - - @Override - public Class getGuiClass() - { - return GuiSolarNeutronActivator.class; - } - - public String getRecipeId() - { - return "mekanism.solarneutron"; - } - - public Collection getRecipes() - { - return Recipe.SOLAR_NEUTRON_ACTIVATOR.get().values(); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 70); - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - drawTexturedModalRect(64-xOffset, 39-yOffset, 176, 58, 55, 8); - - if(recipe.inputStack != null) - { - displayGauge(58, 26-xOffset, 14-yOffset, 176, 0, 58, null, recipe.inputStack); - } - - if(recipe.inputStack != null) - { - displayGauge(58, 134-xOffset, 14-yOffset, 176, 0, 58, null, recipe.outputStack); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(64-xOffset, 39-yOffset, 48, 8), getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(SolarNeutronRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) - { - for(SolarNeutronRecipe irecipe : getRecipes()) - { - if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) - { - for(SolarNeutronRecipe irecipe : getRecipes()) - { - if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).inputStack)); - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).outputStack)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(gas != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - GasStack gas = null; - - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+18 && yAxis <= 72+18) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).inputStack; - } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+18 && yAxis <= 72+18) - { - gas = ((CachedIORecipe)arecipes.get(recipe)).outputStack; - } - - if(gas != null) - { - if(button == 0) - { - if(doGasLookup(gas, false)) - { - return true; - } - } - else if(button == 1) - { - if(doGasLookup(gas, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public GasStack inputStack; - public GasStack outputStack; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(GasStack input, GasStack output) - { - inputStack = input; - outputStack = output; - } - - public CachedIORecipe(SolarNeutronRecipe recipe) - { - this(recipe.getInput().ingredient, recipe.getOutput().output); - } - } -} diff --git a/legacy/mekanism.client.nei/ThermalEvaporationRecipeHandler.java b/legacy/mekanism.client.nei/ThermalEvaporationRecipeHandler.java deleted file mode 100644 index bf924aae7..000000000 --- a/legacy/mekanism.client.nei/ThermalEvaporationRecipeHandler.java +++ /dev/null @@ -1,286 +0,0 @@ -package mekanism.client.nei; - -import static codechicken.lib.gui.GuiDraw.changeTexture; -import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Collection; -import java.util.List; - -import mekanism.client.gui.GuiThermalEvaporationController; -import mekanism.common.ObfuscatedNames; -import mekanism.common.recipe.RecipeHandler.Recipe; -import mekanism.common.recipe.machines.ThermalEvaporationRecipe; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; - -public class ThermalEvaporationRecipeHandler extends BaseRecipeHandler -{ - private int ticksPassed; - - public static int xOffset = 5; - public static int yOffset = 12; - - @Override - public String getRecipeName() - { - return LangUtils.localize("gui.thermalEvaporationController.short"); - } - - @Override - public String getOverlayIdentifier() - { - return "thermalevaporation"; - } - - @Override - public String getGuiTexture() - { - return "mekanism:gui/nei/GuiThermalEvaporationController.png"; - } - - @Override - public Class getGuiClass() - { - return GuiThermalEvaporationController.class; - } - - public String getRecipeId() - { - return "mekanism.thermalevaporation"; - } - - public Collection getRecipes() - { - return Recipe.THERMAL_EVAPORATION_PLANT.get().values(); - } - - @Override - public void loadTransferRects() - { - transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(49-xOffset, 20-yOffset, 78, 38), getRecipeId(), new Object[0])); - } - - @Override - public void drawBackground(int i) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - changeTexture(getGuiTexture()); - drawTexturedModalRect(-2, 0, 3, yOffset, 170, 62); - } - - @Override - public void drawExtras(int i) - { - CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); - - drawProgressBar(49-xOffset, 64-yOffset, 176, 59, 78, 8, ticksPassed < 20 ? ticksPassed % 20 / 20.0F : 1.0F, 0); - - if(recipe.fluidInput != null) - { - displayGauge(58, 7-xOffset, 14-yOffset, 176, 0, 58, recipe.fluidInput, null); - } - - if(recipe.fluidOutput != null) - { - displayGauge(58, 153-xOffset, 14-yOffset, 176, 0, 58, recipe.fluidOutput, null); - } - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - ticksPassed++; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) - { - if(outputId.equals(getRecipeId())) - { - for(ThermalEvaporationRecipe irecipe : getRecipes()) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - else if(outputId.equals("fluid") && results.length == 1 && results[0] instanceof FluidStack) - { - for(ThermalEvaporationRecipe irecipe : getRecipes()) - { - if(((FluidStack)results[0]).isFluidEqual(irecipe.recipeOutput.output)) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) - { - if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) - { - for(ThermalEvaporationRecipe irecipe : getRecipes()) - { - if(irecipe.recipeInput.ingredient.isFluidEqual((FluidStack)ingredients[0])) - { - arecipes.add(new CachedIORecipe(irecipe)); - } - } - } - else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe) arecipes.get(recipe)).fluidInput)); - } - else if(xAxis >= 153 && xAxis <= 169 && yAxis >= 14+4 && yAxis <= 72+4) - { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe) arecipes.get(recipe)).fluidOutput)); - } - - return super.handleTooltip(gui, currenttip, recipe); - } - - @Override - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - FluidStack stack = null; - - if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).fluidInput; - } - else if(xAxis >= 153 && xAxis <= 169 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).fluidOutput; - } - - if(stack != null) - { - if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) - { - if(doFluidLookup(stack, false)) - { - return true; - } - } - else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) - { - if(doFluidLookup(stack, true)) - { - return true; - } - } - } - - return super.keyTyped(gui, keyChar, keyCode, recipe); - } - - @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) - { - Point point = GuiDraw.getMousePosition(); - - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - - FluidStack stack = null; - - if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).fluidInput; - } - else if(xAxis >= 153 && xAxis <= 169 && yAxis >= 14+4 && yAxis <= 72+4) - { - stack = ((CachedIORecipe)arecipes.get(recipe)).fluidOutput; - } - - if(stack != null) - { - if(button == 0) - { - if(doFluidLookup(stack, false)) - { - return true; - } - } - else if(button == 1) - { - if(doFluidLookup(stack, true)) - { - return true; - } - } - } - - return super.mouseClicked(gui, button, recipe); - } - - @Override - public int recipiesPerPage() - { - return 1; - } - - @Override - public void addGuiElements() - { - - } - - public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe - { - public FluidStack fluidInput; - public FluidStack fluidOutput; - - @Override - public PositionedStack getResult() - { - return null; - } - - public CachedIORecipe(FluidStack input, FluidStack output) - { - fluidInput = input; - fluidOutput = output; - } - - public CachedIORecipe(ThermalEvaporationRecipe recipe) - { - this((FluidStack)recipe.recipeInput.ingredient, (FluidStack)recipe.recipeOutput.output); - } - } -} diff --git a/legacy/mekanism.client.render.block/BasicRenderingHandler.java b/legacy/mekanism.client.render.block/BasicRenderingHandler.java deleted file mode 100644 index 1584e582c..000000000 --- a/legacy/mekanism.client.render.block/BasicRenderingHandler.java +++ /dev/null @@ -1,92 +0,0 @@ -package mekanism.client.render.block; - -import mekanism.client.ClientProxy; -import mekanism.client.model.ModelSecurityDesk; -import mekanism.client.render.MekanismRenderer; -import mekanism.common.MekanismBlocks; -import mekanism.common.block.BlockBasic.BasicType; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.world.IBlockAccess; - -import org.lwjgl.opengl.GL11; - -import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class BasicRenderingHandler implements ISimpleBlockRenderingHandler -{ - private Minecraft mc = Minecraft.getMinecraft(); - - public ModelSecurityDesk securityDesk = new ModelSecurityDesk(); - - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) - { - GL11.glPushMatrix(); - GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - - BasicType type = BasicType.get(block, metadata); - - if(type != null) - { - if(type == BasicType.STRUCTURAL_GLASS) - { - MekanismRenderer.blendOn(); - } - - if(type != BasicType.SECURITY_DESK) - { - GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); - MekanismRenderer.renderItem(renderer, metadata, block); - } - else { - GL11.glRotatef(180, 1.0F, 0.0F, 0.0F); - GL11.glScalef(0.8F, 0.8F, 0.8F); - GL11.glTranslatef(0.0F, -0.8F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "SecurityDesk.png")); - securityDesk.render(0.0625F, mc.renderEngine); - } - - if(type == BasicType.STRUCTURAL_GLASS) - { - MekanismRenderer.blendOff(); - } - } - - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - if(block == MekanismBlocks.BasicBlock || block == MekanismBlocks.BasicBlock2) - { - int metadata = world.getBlockMetadata(x, y, z); - - renderer.renderStandardBlock(block, x, y, z); - renderer.setRenderBoundsFromBlock(block); - - return true; - } - - return false; - } - - @Override - public int getRenderId() - { - return ClientProxy.BASIC_RENDER_ID; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) - { - return true; - } -} diff --git a/legacy/mekanism.client.render.block/CTMRenderingHandler.java b/legacy/mekanism.client.render.block/CTMRenderingHandler.java deleted file mode 100644 index b41e830b5..000000000 --- a/legacy/mekanism.client.render.block/CTMRenderingHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -package mekanism.client.render.block; - -import mekanism.api.MekanismConfig; -import mekanism.client.ClientProxy; -import mekanism.client.render.MekanismRenderer; -import mekanism.common.CTMData; -import mekanism.common.base.IBlockCTM; -import mekanism.common.block.BlockMachine.MachineType; -import mekanism.common.tile.TileEntityBasicBlock; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler; - -/** - * CTM ISBRH adapted from Chisel - * Code licensed under GPLv2 - * @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket - */ -public class CTMRenderingHandler implements ISimpleBlockRenderingHandler -{ - RenderBlocksCTM rendererCTM = new RenderBlocksCTM(); - - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) - { - MekanismRenderer.renderItem(renderer, metadata, block); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld) - { - int meta = world.getBlockMetadata(x, y, z); - - if(block instanceof IBlockCTM && !((IBlockCTM)block).shouldRenderBlock(world, x, y, z, meta)) - { - return false; - } - - CTMData blockCTM = ((IBlockCTM)block).getCTMData(world, x, y, z, meta); - - if(MekanismConfig.client.renderCTM && blockCTM != null) - { - if(blockCTM.hasFacingOverride() && world.getTileEntity(x, y, z) instanceof TileEntityBasicBlock) - { - TileEntityBasicBlock tile = (TileEntityBasicBlock)world.getTileEntity(x, y, z); - blockCTM.setFacing(tile.facing); - } - - rendererCTM.blockAccess = world; - rendererCTM.renderMaxX = 1.0; - rendererCTM.renderMaxY = 1.0; - rendererCTM.renderMaxZ = 1.0; - - rendererCTM.dataCTM = blockCTM; - - rendererCTM.rendererOld = rendererOld; - - return rendererCTM.renderStandardBlock(block, x, y, z); - } - - if(MachineType.get(block, meta) != null) - { - TileEntity tile = world.getTileEntity(x, y, z); - - int prevRotateTop = rendererOld.uvRotateTop; - int prevRotateBottom = rendererOld.uvRotateBottom; - - if(tile instanceof TileEntityBasicBlock) - { - if(((TileEntityBasicBlock)tile).facing >= 2) - { - rendererOld.uvRotateTop = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2]; - rendererOld.uvRotateBottom = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2]; - } - } - - rendererOld.renderStandardBlock(block, x, y, z); - rendererOld.setRenderBoundsFromBlock(block); - - rendererOld.uvRotateTop = prevRotateTop; - rendererOld.uvRotateBottom = prevRotateBottom; - - return true; - } - - return rendererOld.renderStandardBlock(block, x, y, z); - } - - @Override - public boolean shouldRender3DInInventory(int renderId) - { - return true; - } - - @Override - public int getRenderId() - { - return ClientProxy.CTM_RENDER_ID; - } -} diff --git a/legacy/mekanism.client.render.block/MachineRenderingHandler.java b/legacy/mekanism.client.render.block/MachineRenderingHandler.java deleted file mode 100644 index 624387e88..000000000 --- a/legacy/mekanism.client.render.block/MachineRenderingHandler.java +++ /dev/null @@ -1,272 +0,0 @@ -package mekanism.client.render.block; - -import mekanism.client.ClientProxy; -import mekanism.client.model.ModelChargepad; -import mekanism.client.model.ModelChemicalCrystallizer; -import mekanism.client.model.ModelChemicalDissolutionChamber; -import mekanism.client.model.ModelChemicalInfuser; -import mekanism.client.model.ModelChemicalOxidizer; -import mekanism.client.model.ModelChemicalWasher; -import mekanism.client.model.ModelDigitalMiner; -import mekanism.client.model.ModelElectricPump; -import mekanism.client.model.ModelElectrolyticSeparator; -import mekanism.client.model.ModelFluidicPlenisher; -import mekanism.client.model.ModelLaser; -import mekanism.client.model.ModelLaserAmplifier; -import mekanism.client.model.ModelLogisticalSorter; -import mekanism.client.model.ModelMetallurgicInfuser; -import mekanism.client.model.ModelPressurizedReactionChamber; -import mekanism.client.model.ModelQuantumEntangloporter; -import mekanism.client.model.ModelResistiveHeater; -import mekanism.client.model.ModelRotaryCondensentrator; -import mekanism.client.model.ModelSeismicVibrator; -import mekanism.client.model.ModelSolarNeutronActivator; -import mekanism.client.render.MekanismRenderer; -import mekanism.common.block.BlockMachine.MachineType; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.world.IBlockAccess; - -import org.lwjgl.opengl.GL11; - -import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class MachineRenderingHandler implements ISimpleBlockRenderingHandler -{ - private Minecraft mc = Minecraft.getMinecraft(); - - public ModelElectricPump electricPump = new ModelElectricPump(); - public ModelMetallurgicInfuser metallurgicInfuser = new ModelMetallurgicInfuser(); - public ModelChargepad chargepad = new ModelChargepad(); - public ModelLogisticalSorter logisticalSorter = new ModelLogisticalSorter(); - public ModelDigitalMiner digitalMiner = new ModelDigitalMiner(); - public ModelRotaryCondensentrator rotaryCondensentrator = new ModelRotaryCondensentrator(); - public ModelChemicalOxidizer chemicalOxidizer = new ModelChemicalOxidizer(); - public ModelChemicalInfuser chemicalInfuser = new ModelChemicalInfuser(); - public ModelElectrolyticSeparator electrolyticSeparator = new ModelElectrolyticSeparator(); - public ModelChemicalDissolutionChamber chemicalDissolutionChamber = new ModelChemicalDissolutionChamber(); - public ModelChemicalWasher chemicalWasher = new ModelChemicalWasher(); - public ModelChemicalCrystallizer chemicalCrystallizer = new ModelChemicalCrystallizer(); - public ModelSeismicVibrator seismicVibrator = new ModelSeismicVibrator(); - public ModelPressurizedReactionChamber pressurizedReactionChamber = new ModelPressurizedReactionChamber(); - public ModelFluidicPlenisher fluidicPlenisher = new ModelFluidicPlenisher(); - public ModelLaser laser = new ModelLaser(); - public ModelLaserAmplifier laserAmplifier = new ModelLaserAmplifier(); - public ModelSolarNeutronActivator solarNeutronActivator = new ModelSolarNeutronActivator(); - public ModelResistiveHeater resistiveHeater = new ModelResistiveHeater(); - public ModelQuantumEntangloporter quantumEntangloporter = new ModelQuantumEntangloporter(); - - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) - { - if(block == null || renderer == null || MachineType.get(block, metadata) == null) - { - return; - } - - GL11.glPushMatrix(); - GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - - MachineType type = MachineType.get(block, metadata); - - if(type == MachineType.ELECTRIC_PUMP) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(0.0F, -0.85F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png")); - electricPump.render(0.0560F); - } - else if(type == MachineType.METALLURGIC_INFUSER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -1.0F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "MetallurgicInfuser.png")); - metallurgicInfuser.render(0.0625F); - } - else if(type == MachineType.CHARGEPAD) - { - GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); - GL11.glTranslatef(0.0F, -1.1F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Chargepad.png")); - chargepad.render(0.0625F, mc.renderEngine); - } - else if(type == MachineType.LOGISTICAL_SORTER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.0F, -1.0F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalSorter.png")); - logisticalSorter.render(0.0625F, false); - } - else if(type == MachineType.DIGITAL_MINER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-180F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.35F, 0.1F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "DigitalMiner.png")); - digitalMiner.render(0.022F, false, mc.renderEngine); - } - else if(type == MachineType.ROTARY_CONDENSENTRATOR) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RotaryCondensentrator.png")); - rotaryCondensentrator.render(0.0625F); - } - else if(type == MachineType.CHEMICAL_OXIDIZER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.0F, -1.00F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalOxidizer.png")); - chemicalOxidizer.render(0.0625F); - } - else if(type == MachineType.CHEMICAL_INFUSER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180f, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalInfuser.png")); - chemicalInfuser.render(0.0625F); - } - else if(type == MachineType.ELECTROLYTIC_SEPARATOR) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); - GL11.glTranslated(0.0F, -1.0F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectrolyticSeparator.png")); - electrolyticSeparator.render(0.0625F); - } - else if(type == MachineType.CHEMICAL_DISSOLUTION_CHAMBER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalDissolutionChamber.png")); - chemicalDissolutionChamber.render(0.0625F); - } - else if(type == MachineType.CHEMICAL_WASHER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalWasher.png")); - chemicalWasher.render(0.0625F); - } - else if(type == MachineType.CHEMICAL_CRYSTALLIZER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalCrystallizer.png")); - chemicalCrystallizer.render(0.0625F); - } - else if(type == MachineType.SEISMIC_VIBRATOR) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glScalef(0.6F, 0.6F, 0.6F); - GL11.glTranslatef(0.0F, -0.55F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "SeismicVibrator.png")); - seismicVibrator.render(0.0625F); - } - else if(type == MachineType.PRESSURIZED_REACTION_CHAMBER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedReactionChamber.png")); - pressurizedReactionChamber.render(0.0625F); - } - else if(type == MachineType.FLUIDIC_PLENISHER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.85F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FluidicPlenisher.png")); - fluidicPlenisher.render(0.0560F); - } - else if(type == MachineType.LASER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.85F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Laser.png")); - laser.render(0.0560F); - } - else if(type == MachineType.LASER_AMPLIFIER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.85F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LaserAmplifier.png")); - laserAmplifier.render(0.0560F); - } - else if(type == MachineType.LASER_TRACTOR_BEAM) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.85F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LaserTractorBeam.png")); - laserAmplifier.render(0.0560F); - } - else if(type == MachineType.RESISTIVE_HEATER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.05F, -0.96F, 0.05F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ResistiveHeater.png")); - resistiveHeater.render(0.0625F, false, mc.renderEngine); - } - else if(type == MachineType.SOLAR_NEUTRON_ACTIVATOR) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(0.6F, 0.6F, 0.6F); - GL11.glTranslatef(0.0F, -0.55F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "SolarNeutronActivator.png")); - solarNeutronActivator.render(0.0625F); - } - else if(type == MachineType.QUANTUM_ENTANGLOPORTER) - { - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); - GL11.glTranslatef(0.0F, -1.0F, 0.0F); - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "QuantumEntangloporter.png")); - quantumEntangloporter.render(0.0625F, mc.renderEngine); - } - else { - GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); - MekanismRenderer.renderItem(renderer, metadata, block); - } - - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - //Handled by CTMRenderingHandler - return false; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) - { - return true; - } - - @Override - public int getRenderId() - { - return ClientProxy.MACHINE_RENDER_ID; - } -} diff --git a/legacy/mekanism.client.render.block/PlasticRenderingHandler.java b/legacy/mekanism.client.render.block/PlasticRenderingHandler.java deleted file mode 100644 index 3f13ae1f5..000000000 --- a/legacy/mekanism.client.render.block/PlasticRenderingHandler.java +++ /dev/null @@ -1,96 +0,0 @@ -package mekanism.client.render.block; - -import mekanism.client.ClientProxy; -import mekanism.client.render.MekanismRenderer; -import mekanism.common.MekanismBlocks; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class PlasticRenderingHandler implements ISimpleBlockRenderingHandler -{ - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) - { - MekanismRenderer.renderItem(renderer, metadata, block); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - boolean flag = false; - - if(block == MekanismBlocks.GlowPlasticBlock) - { - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(240); - int meta = world.getBlockMetadata(x, y, z); - int l = block.getRenderColor(meta); - int r = l >> 16 & 0xFF; - int g = l >> 8 & 0xFF; - int b = l & 0xFF; - tessellator.setColorOpaque(r, g, b); - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y - 1, z, 0))) - { - renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 0)); - flag = true; - } - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y + 1, z, 1))) - { - renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 1)); - flag = true; - } - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y, z - 1, 2))) - { - renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 2)); - flag = true; - } - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y, z + 1, 3))) - { - renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 3)); - flag = true; - } - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x - 1, y, z, 4))) - { - renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 4)); - flag = true; - } - - if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x + 1, y, z, 5))) - { - renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 5)); - flag = true; - } - - return flag; - } - - flag = renderer.renderStandardBlock(block, x, y, z); - renderer.setRenderBoundsFromBlock(block); - - return flag; - - } - - @Override - public int getRenderId() - { - return ClientProxy.PLASTIC_RENDER_ID; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) - { - return true; - } -} diff --git a/legacy/mekanism.client.render.block/RenderBlocksCTM.java b/legacy/mekanism.client.render.block/RenderBlocksCTM.java deleted file mode 100644 index 871ff161e..000000000 --- a/legacy/mekanism.client.render.block/RenderBlocksCTM.java +++ /dev/null @@ -1,382 +0,0 @@ -package mekanism.client.render.block; - -import mekanism.client.render.CTM; -import mekanism.common.CTMData; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; - -/** - * CTM RenderBlocks adapted from Chisel - * Code licensed under GPLv2 - * @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket - */ -public class RenderBlocksCTM extends RenderBlocks -{ - RenderBlocksCTM() - { - super(); - - resetVertices(); - } - - Tessellator tessellator; - double[] X = new double[26]; - double[] Y = new double[26]; - double[] Z = new double[26]; - double[] U = new double[26]; - double[] V = new double[26]; - int[] L = new int[26]; - float[] R = new float[26]; - float[] G = new float[26]; - float[] B = new float[26]; - CTMData dataCTM; - RenderBlocks rendererOld; - - int bx, by, bz; - - @Override - public boolean renderStandardBlock(Block block, int x, int y, int z) - { - bx = x; - by = y; - bz = z; - - tessellator = Tessellator.instance; - tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); - - tessellator.addTranslation(x, y, z); - - boolean res = super.renderStandardBlock(block, x, y, z); - - tessellator.addTranslation(-x, -y, -z); - - return res; - } - - void setupSides(int a, int b, int c, int d, int xa, int xb, int xc, int xd, int e) - { - L[a] = brightnessBottomLeft; - L[b] = brightnessBottomRight; - L[c] = brightnessTopRight; - L[d] = brightnessTopLeft; - L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4; - L[xa] = (L[a] + L[b]) / 2; - L[xb] = (L[b] + L[c]) / 2; - L[xc] = (L[c] + L[d]) / 2; - L[xd] = (L[d] + L[a]) / 2; - - R[a] = colorRedBottomLeft; - R[b] = colorRedBottomRight; - R[c] = colorRedTopRight; - R[d] = colorRedTopLeft; - R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4; - R[xa] = (R[a] + R[b]) / 2; - R[xb] = (R[b] + R[c]) / 2; - R[xc] = (R[c] + R[d]) / 2; - R[xd] = (R[d] + R[a]) / 2; - - G[a] = colorGreenBottomLeft; - G[b] = colorGreenBottomRight; - G[c] = colorGreenTopRight; - G[d] = colorGreenTopLeft; - G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4; - G[xa] = (G[a] + G[b]) / 2; - G[xb] = (G[b] + G[c]) / 2; - G[xc] = (G[c] + G[d]) / 2; - G[xd] = (G[d] + G[a]) / 2; - - B[a] = colorBlueBottomLeft; - B[b] = colorBlueBottomRight; - B[c] = colorBlueTopRight; - B[d] = colorBlueTopLeft; - B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4; - B[xa] = (B[a] + B[b]) / 2; - B[xb] = (B[b] + B[c]) / 2; - B[xc] = (B[c] + B[d]) / 2; - B[xd] = (B[d] + B[a]) / 2; - } - - void side(int a, int b, int c, int d, int iconIndex, boolean flip, int side) - { - IIcon icon = iconIndex >= 16 ? dataCTM.getSmallSubmap(side).icons[iconIndex - 16] : dataCTM.getSubmap(side).icons[iconIndex]; - - double u0 = icon.getMaxU(); - double u1 = icon.getMinU(); - double v0 = icon.getMaxV(); - double v1 = icon.getMinV(); - - U[a] = flip ? u1 : u1; - U[b] = flip ? u0 : u1; - U[c] = flip ? u0 : u0; - U[d] = flip ? u1 : u0; - - V[a] = flip ? v1 : v1; - V[b] = flip ? v1 : v0; - V[c] = flip ? v0 : v0; - V[d] = flip ? v0 : v1; - - vert(a); - vert(b); - vert(c); - vert(d); - } - - void vert(int index) - { - if(enableAO) - { - tessellator.setColorOpaque_F(R[index], G[index], B[index]); - tessellator.setBrightness(L[index]); - } - - tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]); - } - - @Override - public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV()); - tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); - tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(1, 0, 4, 5, 14, 19, 17, 23, 9); - side(1, 14, 9, 23, tex[0], false, 4); - side(23, 9, 17, 5, tex[1], false, 4); - side(9, 19, 4, 17, tex[3], false, 4); - side(14, 0, 19, 9, tex[2], false, 4); - } - } - - @Override - public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); - tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(3, 2, 6, 7, 15, 25, 16, 21, 11); - side(11, 21, 3, 15, tex[3], false, 5); - side(16, 7, 21, 11, tex[2], false, 5); - side(25, 11, 15, 2, tex[1], false, 5); - side(6, 16, 11, 25, tex[0], false, 5); - } - } - - @Override - public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); - tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMaxV()); - tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(2, 3, 0, 1, 15, 18, 14, 22, 8); - side(2, 15, 8, 22, tex[0], false, 2); - side(15, 3, 18, 8, tex[2], false, 2); - side(8, 18, 0, 14, tex[3], false, 2); - side(22, 8, 14, 1, tex[1], false, 2); - } - } - - - @Override - public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMinV()); - tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(4, 7, 6, 5, 20, 16, 24, 17, 10); - side(17, 4, 20, 10, tex[2], false, 3); - side(5, 17, 10, 24, tex[0], false, 3); - side(24, 10, 16, 6, tex[1], false, 3); - side(10, 20, 7, 16, tex[3], false, 3); - } - } - - @Override - public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMinV()); - tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV()); - tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(0, 3, 7, 4, 18, 21, 20, 19, 13); - side(13, 21, 7, 20, tex[3], true, 0); - side(19, 13, 20, 4, tex[2], true, 0); - side(0, 18, 13, 19, tex[0], true, 0); - side(18, 3, 21, 13, tex[1], true, 0); - } - } - - @Override - public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) - { - if(rendererOld != null && rendererOld.hasOverrideBlockTexture()) - { - IIcon i = rendererOld.overrideBlockTexture; - - tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV()); - tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV()); - tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV()); - } - else { - int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1, dataCTM.acceptableBlockMetas, dataCTM.renderConvexConnections); - - setupSides(2, 1, 5, 6, 22, 23, 24, 25, 12); - side(12, 24, 6, 25, tex[3], false, 1); - side(22, 12, 25, 2, tex[1], false, 1); - side(1, 23, 12, 22, tex[0], false, 1); - side(23, 5, 24, 12, tex[2], false, 1); - } - } - - void resetVertices() - { - X[0] = 0; - Z[0] = 0; - Y[0] = 0; - - X[1] = 0; - Z[1] = 0; - Y[1] = 1; - - X[2] = 1; - Z[2] = 0; - Y[2] = 1; - - X[3] = 1; - Z[3] = 0; - Y[3] = 0; - - X[4] = 0; - Z[4] = 1; - Y[4] = 0; - - X[5] = 0; - Z[5] = 1; - Y[5] = 1; - - X[6] = 1; - Z[6] = 1; - Y[6] = 1; - - X[7] = 1; - Z[7] = 1; - Y[7] = 0; - - X[8] = 0.5; - Z[8] = 0; - Y[8] = 0.5; - - X[9] = 0; - Z[9] = 0.5; - Y[9] = 0.5; - - X[10] = 0.5; - Z[10] = 1; - Y[10] = 0.5; - - X[11] = 1; - Z[11] = 0.5; - Y[11] = 0.5; - - X[12] = 0.5; - Z[12] = 0.5; - Y[12] = 1; - - X[13] = 0.5; - Z[13] = 0.5; - Y[13] = 0; - - X[14] = 0; - Z[14] = 0; - Y[14] = 0.5; - - X[15] = 1; - Z[15] = 0; - Y[15] = 0.5; - - X[16] = 1; - Z[16] = 1; - Y[16] = 0.5; - - X[17] = 0; - Z[17] = 1; - Y[17] = 0.5; - - X[18] = 0.5; - Z[18] = 0; - Y[18] = 0; - - X[19] = 0; - Z[19] = 0.5; - Y[19] = 0; - - X[20] = 0.5; - Z[20] = 1; - Y[20] = 0; - - X[21] = 1; - Z[21] = 0.5; - Y[21] = 0; - - X[22] = 0.5; - Z[22] = 0; - Y[22] = 1; - - X[23] = 0; - Z[23] = 0.5; - Y[23] = 1; - - X[24] = 0.5; - Z[24] = 1; - Y[24] = 1; - - X[25] = 1; - Z[25] = 0.5; - Y[25] = 1; - } -} diff --git a/legacy/mekanism.client.render.block/TextureSubmap.java b/legacy/mekanism.client.render.block/TextureSubmap.java deleted file mode 100644 index 817b7850a..000000000 --- a/legacy/mekanism.client.render.block/TextureSubmap.java +++ /dev/null @@ -1,42 +0,0 @@ -package mekanism.client.render.block; - -import net.minecraft.util.IIcon; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -/** - * Multi-texture class adapted from Chisel - * Code licensed under GPLv2 - * @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket - */ -public class TextureSubmap -{ - public int width, height; - - public IIcon icon; - - public IIcon icons[]; - - public TextureSubmap(IIcon i, int w, int h) - { - icon = i; - width = w; - height = h; - icons = new IIcon[width * height]; - - MinecraftForge.EVENT_BUS.register(this); - } - - @SubscribeEvent - public void TexturesStitched(TextureStitchEvent.Post event) - { - for(int x = 0; x < width; x++) - { - for(int y = 0; y < height; y++) - { - icons[y * width + x] = new TextureVirtual(icon, width, height, x, y); - } - } - } -} diff --git a/legacy/mekanism.client.render.block/TextureVirtual.java b/legacy/mekanism.client.render.block/TextureVirtual.java deleted file mode 100644 index 6bc921a6a..000000000 --- a/legacy/mekanism.client.render.block/TextureVirtual.java +++ /dev/null @@ -1,96 +0,0 @@ -package mekanism.client.render.block; - -import net.minecraft.util.IIcon; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Texture component class adapted from Chisel - * Code licensed under GPLv2 - * @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket - */ -public class TextureVirtual implements IIcon -{ - int ox, oy; - float u0, u1, v0, v1; - String name; - IIcon icon; - - TextureVirtual(IIcon parent, int w, int h, int x, int y) - { - icon = parent; - - u0 = icon.getInterpolatedU(16.0 * (x) / w); - u1 = icon.getInterpolatedU(16.0 * (x + 1) / w); - v0 = icon.getInterpolatedV(16.0 * (y) / h); - v1 = icon.getInterpolatedV(16.0 * (y + 1) / h); - - name = icon.getIconName() + "|" + x + "." + y; - - ox = icon.getIconWidth(); - oy = icon.getIconHeight(); - } - - @Override - @SideOnly(Side.CLIENT) - public float getMinU() - { - return u0; - } - - @Override - @SideOnly(Side.CLIENT) - public float getMaxU() - { - return u1; - } - - @Override - @SideOnly(Side.CLIENT) - public float getInterpolatedU(double d0) - { - return (float) (u0 + (u1 - u0) * d0 / 16.0); - } - - @Override - @SideOnly(Side.CLIENT) - public float getMinV() - { - return v0; - } - - @Override - @SideOnly(Side.CLIENT) - public float getMaxV() - { - return v1; - } - - @Override - @SideOnly(Side.CLIENT) - public float getInterpolatedV(double d0) - { - return (float) (v0 + (v1 - v0) * d0 / 16.0); - } - - @Override - @SideOnly(Side.CLIENT) - public String getIconName() - { - return name; - } - - @Override - @SideOnly(Side.CLIENT) - public int getIconWidth() - { - return ox; - } - - @Override - @SideOnly(Side.CLIENT) - public int getIconHeight() - { - return oy; - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java index c88d2c81e..4d1ddcfce 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java @@ -11,7 +11,6 @@ import mekanism.common.recipe.machines.PressurizedRecipe; import mekanism.common.util.LangUtils; import mezz.jei.api.recipe.BlankRecipeWrapper; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; public class PRCRecipeWrapper extends BlankRecipeWrapper @@ -30,21 +29,21 @@ public class PRCRecipeWrapper extends BlankRecipeWrapper @Override public List getInputs() { - return new ArrayList(); + return Arrays.asList(recipe.getInput().getSolid()); } @Nonnull @Override public List getFluidInputs() { - return Arrays.asList(new FluidStack(FluidRegistry.WATER, 1000)); + return Arrays.asList(recipe.getInput().getFluid()); } @Nonnull @Override public List getOutputs() { - return new ArrayList(); + return Arrays.asList(recipe.getOutput().getItemOutput()); } @Nullable @@ -53,13 +52,13 @@ public class PRCRecipeWrapper extends BlankRecipeWrapper { List currenttip = new ArrayList(); - if(mouseX >= 26-3 && mouseX <= 42-3 && mouseY >= 14-12 && mouseY <= 72-12) + if(mouseX >= 29-3 && mouseX <= 45-3 && mouseY >= 11-12 && mouseY <= 69-12) { - currenttip.add(LangUtils.localizeGasStack(((CachedIORecipe)arecipes.get(recipe)).gasStack)); + currenttip.add(LangUtils.localizeGasStack(recipe.getInput().getGas())); } - else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-12 && mouseY <= 72-12) + else if(mouseX >= 141-3 && mouseX <= 157-3 && mouseY >= 41-12 && mouseY <= 69-12) { - currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidStack)); + currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().getGasOutput())); } return currenttip;