diff --git a/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java b/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java index 2a79d2a78..ff9eaa07e 100644 --- a/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java +++ b/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java @@ -47,15 +47,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler @Override public void drawExtras(int i) { - float f = ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F; + /*float f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F; drawProgressBar(63, 34, 176, 0, 24, 7, f, 0); - f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F; - if(ticksPassed < 20) f = 0.0F; - drawProgressBar(45, 32, 176, 7, 5, 12, f, 3); - - f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; - drawProgressBar(149, 12, 176, 19, 4, 52, f, 3); + int displayInt = ticksPassed < 20 ? (); + displayGauge(61, 37 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());*/ } @Override diff --git a/common/mekanism/client/nei/BaseRecipeHandler.java b/common/mekanism/client/nei/BaseRecipeHandler.java index 3dd8e8a46..8c291b983 100644 --- a/common/mekanism/client/nei/BaseRecipeHandler.java +++ b/common/mekanism/client/nei/BaseRecipeHandler.java @@ -85,6 +85,17 @@ public abstract class BaseRecipeHandler extends TemplateRecipeHandler 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); + } + /* * true = usage, false = recipe */ diff --git a/common/mekanism/common/IFactory.java b/common/mekanism/common/IFactory.java index 7764f817a..7b2f5a190 100644 --- a/common/mekanism/common/IFactory.java +++ b/common/mekanism/common/IFactory.java @@ -1,5 +1,7 @@ package mekanism.common; +import mekanism.api.AdvancedInput; +import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.recipe.RecipeHandler; @@ -32,21 +34,22 @@ public interface IFactory public static enum RecipeType { - SMELTING("smelting", "Smelter.ogg", MachineType.ENERGIZED_SMELTER.getStack(), false), - ENRICHING("enriching", "Chamber.ogg", MachineType.ENRICHMENT_CHAMBER.getStack(), false), - CRUSHING("crushing", "Crusher.ogg", MachineType.CRUSHER.getStack(), false), - COMPRESSING("compressing", "Compressor.ogg", MachineType.OSMIUM_COMPRESSOR.getStack(), true), - COMBINING("combining", "Combiner.ogg", MachineType.COMBINER.getStack(), true), - PURIFYING("purifying", "PurificationChamber.ogg", MachineType.PURIFICATION_CHAMBER.getStack(), true), - INJECTING("injecting", "ChemicalInjectionChamber.ogg", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true); + SMELTING("smelting", "Smelter.ogg", MachineType.ENERGIZED_SMELTER.getStack(), false, null), + ENRICHING("enriching", "Chamber.ogg", MachineType.ENRICHMENT_CHAMBER.getStack(), false, Recipe.ENRICHMENT_CHAMBER), + CRUSHING("crushing", "Crusher.ogg", MachineType.CRUSHER.getStack(), false, Recipe.CRUSHER), + COMPRESSING("compressing", "Compressor.ogg", MachineType.OSMIUM_COMPRESSOR.getStack(), true, Recipe.OSMIUM_COMPRESSOR), + COMBINING("combining", "Combiner.ogg", MachineType.COMBINER.getStack(), true, Recipe.COMBINER), + PURIFYING("purifying", "PurificationChamber.ogg", MachineType.PURIFICATION_CHAMBER.getStack(), true, Recipe.PURIFICATION_CHAMBER), + INJECTING("injecting", "ChemicalInjectionChamber.ogg", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, Recipe.CHEMICAL_INJECTION_CHAMBER); private String name; private String sound; private ItemStack stack; private boolean usesFuel; + private Recipe recipe; private TileEntityAdvancedElectricMachine cacheTile; - public ItemStack getCopiedOutput(ItemStack input, boolean stackDecrease) + public ItemStack getCopiedOutput(ItemStack input, Gas gas, boolean stackDecrease) { if(input == null) { @@ -66,33 +69,17 @@ public interface IFactory return toReturn; } - } - else if(this == ENRICHING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.ENRICHMENT_CHAMBER.get()); - } - else if(this == CRUSHING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.CRUSHER.get()); - } - else if(this == COMPRESSING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.OSMIUM_COMPRESSOR.get()); - } - else if(this == COMBINING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.COMBINER.get()); - } - else if(this == PURIFYING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.PURIFICATION_CHAMBER.get()); - } - else if(this == INJECTING) - { - return RecipeHandler.getOutput(input, stackDecrease, Recipe.CHEMICAL_INJECTION_CHAMBER.get()); + + return null; } - return null; + if(usesFuel()) + { + return RecipeHandler.getOutput(new AdvancedInput(input, gas), stackDecrease, recipe.get()); + } + else { + return RecipeHandler.getOutput(input, stackDecrease, recipe.get()); + } } public GasStack getItemGas(ItemStack itemstack) @@ -151,12 +138,13 @@ public interface IFactory return usesFuel; } - private RecipeType(String s, String s1, ItemStack is, boolean b) + private RecipeType(String s, String s1, ItemStack is, boolean b, Recipe r) { name = s; sound = s1; stack = is; usesFuel = b; + recipe = r; } } } diff --git a/common/mekanism/common/integration/OreDictManager.java b/common/mekanism/common/integration/OreDictManager.java index ba643c49d..f028ecdd5 100644 --- a/common/mekanism/common/integration/OreDictManager.java +++ b/common/mekanism/common/integration/OreDictManager.java @@ -237,15 +237,15 @@ public final class OreDictManager for(ItemStack ore : OreDictionary.getOres("oreIron")) { - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Mekanism.Dust, 2, 0)); - RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Mekanism.Clump, 3, 0)); + RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 0)); + RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 0)); RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Shard, 4, 0)); } for(ItemStack ore : OreDictionary.getOres("oreGold")) { - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Mekanism.Dust, 2, 1)); - RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Mekanism.Clump, 3, 1)); + RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 2, 1)); + RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Clump, 3, 1)); RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Shard, 4, 1)); } diff --git a/common/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java b/common/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java index a106f1035..bb5781523 100644 --- a/common/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java +++ b/common/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java @@ -1,14 +1,14 @@ package mekanism.common.inventory.container; -import mekanism.api.gas.IGasItem; -import mekanism.common.Mekanism; +import java.util.Map; + +import mekanism.api.AdvancedInput; +import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotMachineUpgrade; import mekanism.common.inventory.slot.SlotOutput; -import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.tile.TileEntityAdvancedElectricMachine; -import mekanism.common.tile.TileEntityPurificationChamber; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -113,7 +113,7 @@ public class ContainerAdvancedElectricMachine extends Container } } } - else if(RecipeHandler.getOutput(slotStack, false, tileEntity.getRecipes()) != null) + else if(isInputItem(slotStack)) { if(slotID != 0) { @@ -186,4 +186,17 @@ public class ContainerAdvancedElectricMachine extends Container return stack; } + + private boolean isInputItem(ItemStack itemstack) + { + for(Map.Entry entry : ((Map)tileEntity.getRecipes()).entrySet()) + { + if(entry.getKey().itemStack.isItemEqual(itemstack)) + { + return true; + } + } + + return false; + } } diff --git a/common/mekanism/common/inventory/container/ContainerFactory.java b/common/mekanism/common/inventory/container/ContainerFactory.java index da9648c50..da50aad8b 100644 --- a/common/mekanism/common/inventory/container/ContainerFactory.java +++ b/common/mekanism/common/inventory/container/ContainerFactory.java @@ -179,7 +179,7 @@ public class ContainerFactory extends Container } } } - else if(RecipeType.values()[tileEntity.recipeType].getCopiedOutput(slotStack, false) != null) + else if(RecipeType.values()[tileEntity.recipeType].getCopiedOutput(slotStack, tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas() : null, false) != null) { if(!isInputSlot(slotID)) { diff --git a/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java b/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java index 8722d3bc8..f937055b8 100644 --- a/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java +++ b/common/mekanism/common/tile/TileEntityAdvancedElectricMachine.java @@ -97,15 +97,15 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM operatingTicks++; - gasTank.draw(SECONDARY_ENERGY_PER_TICK, true); - electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK); - if(operatingTicks >= MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED)) { operate(); operatingTicks = 0; } + + gasTank.draw(SECONDARY_ENERGY_PER_TICK, true); + electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK); } else { if(prevEnergy >= getEnergy()) diff --git a/common/mekanism/common/tile/TileEntityFactory.java b/common/mekanism/common/tile/TileEntityFactory.java index b82a7b5c8..d2db034b8 100644 --- a/common/mekanism/common/tile/TileEntityFactory.java +++ b/common/mekanism/common/tile/TileEntityFactory.java @@ -420,7 +420,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip } else if(slotID >= 5 && slotID <= 7) { - return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null; + return RecipeType.values()[recipeType].getCopiedOutput(itemstack, gasTank.getGas() != null ? gasTank.getGas().getGas() : null, false) != null; } } else if(tier == FactoryTier.ADVANCED) @@ -431,7 +431,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip } else if(slotID >= 5 && slotID <= 9) { - return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null; + return RecipeType.values()[recipeType].getCopiedOutput(itemstack, gasTank.getGas() != null ? gasTank.getGas().getGas() : null, false) != null; } } else if(tier == FactoryTier.ELITE) @@ -442,7 +442,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip } else if(slotID >= 5 && slotID <= 11) { - return RecipeType.values()[recipeType].getCopiedOutput(itemstack, false) != null; + return RecipeType.values()[recipeType].getCopiedOutput(itemstack, gasTank.getGas() != null ? gasTank.getGas().getGas() : null, false) != null; } } @@ -495,7 +495,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip return false; } - ItemStack itemstack = RecipeType.values()[recipeType].getCopiedOutput(inventory[inputSlot], false); + ItemStack itemstack = RecipeType.values()[recipeType].getCopiedOutput(inventory[inputSlot], gasTank.getGas() != null ? gasTank.getGas().getGas() : null, false); if(itemstack == null) { @@ -523,7 +523,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip return; } - ItemStack itemstack = RecipeType.values()[recipeType].getCopiedOutput(inventory[inputSlot], true); + ItemStack itemstack = RecipeType.values()[recipeType].getCopiedOutput(inventory[inputSlot], gasTank.getGas() != null ? gasTank.getGas().getGas() : null, true); if(inventory[inputSlot].stackSize <= 0) {