diff --git a/api b/api index 7d07b4198..3d25676cc 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 7d07b419809a36c63a1e747085a2e8d1f26c67cd +Subproject commit 3d25676cc26f216836baec287624aa12eff92fc9 diff --git a/src/main/java/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index a48076d0b..5a75c7a50 100755 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -26,6 +26,7 @@ import forestry.api.fuels.EngineBronzeFuel; import forestry.api.fuels.EngineCopperFuel; import forestry.api.fuels.FermenterFuel; import forestry.api.fuels.FuelManager; +import forestry.api.fuels.GeneratorFuel; import forestry.api.fuels.MoistenerFuel; import forestry.api.fuels.RainSubstrate; import forestry.core.ForestryCore; @@ -66,6 +67,7 @@ public class Forestry { FuelManager.rainSubstrate = new ItemStackMap(); FuelManager.bronzeEngineFuel = new FluidMap(); FuelManager.copperEngineFuel = new ItemStackMap(); + FuelManager.generatorFuel = new FluidMap(); } @SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore") public static ForestryCore core = new ForestryCore(); diff --git a/src/main/java/forestry/energy/gadgets/MachineGenerator.java b/src/main/java/forestry/energy/gadgets/MachineGenerator.java index 76a8cffcf..607bbc3bc 100755 --- a/src/main/java/forestry/energy/gadgets/MachineGenerator.java +++ b/src/main/java/forestry/energy/gadgets/MachineGenerator.java @@ -24,6 +24,7 @@ import ic2.api.energy.prefab.BasicSource; import forestry.api.core.ForestryAPI; import forestry.api.core.ISpecialInventory; +import forestry.api.fuels.FuelManager; import forestry.api.fuels.GeneratorFuel; import forestry.core.EnumErrorCode; import forestry.core.config.Config; @@ -119,7 +120,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi if (inventory.getStackInSlot(SLOT_CAN) != null) { FluidContainerData container = LiquidHelper.getLiquidContainer(inventory.getStackInSlot(SLOT_CAN)); if (container != null) - if (GeneratorFuel.fuels.containsKey(container.fluid.fluidID)) { + if (FuelManager.generatorFuel.containsKey(container.fluid)) { inventory.setInventorySlotContents(SLOT_CAN, StackUtils.replenishByContainer(this, inventory.getStackInSlot(SLOT_CAN), container, resourceTank)); if (inventory.getStackInSlot(SLOT_CAN).stackSize <= 0) inventory.setInventorySlotContents(SLOT_CAN, null); @@ -134,9 +135,8 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi ic2EnergySource.updateEntity(); - if (resourceTank.getFluidAmount() > 0 && - GeneratorFuel.fuels.containsKey(resourceTank.getFluid().fluidID)) { - GeneratorFuel fuel = GeneratorFuel.fuels.get(resourceTank.getFluid().fluidID); + if (resourceTank.getFluidAmount() > 0 && FuelManager.generatorFuel.containsKey(resourceTank.getFluid())) { + GeneratorFuel fuel = FuelManager.generatorFuel.get(resourceTank.getFluid()); if (resourceTank.getFluidAmount() >= fuel.fuelConsumed.amount && ic2EnergySource.getFreeCapacity() >= fuel.eu) { @@ -239,7 +239,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi if (container == null) return 0; - if (!GeneratorFuel.fuels.containsKey(container.fluid.fluidID)) + if (!FuelManager.generatorFuel.containsKey(container.fluid)) return 0; if (inventory.getStackInSlot(SLOT_CAN) == null) { @@ -272,7 +272,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { // We only accept water - if (!GeneratorFuel.fuels.containsKey(resource.fluidID)) + if (!FuelManager.generatorFuel.containsKey(resource)) return 0; int used = resourceTank.fill(resource, doFill); diff --git a/src/main/java/forestry/plugins/PluginEnergy.java b/src/main/java/forestry/plugins/PluginEnergy.java index f578cac3c..5befe52ff 100755 --- a/src/main/java/forestry/plugins/PluginEnergy.java +++ b/src/main/java/forestry/plugins/PluginEnergy.java @@ -13,7 +13,8 @@ package forestry.plugins; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.FluidStack; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.network.IGuiHandler; @@ -21,6 +22,7 @@ import cpw.mods.fml.common.network.IGuiHandler; import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuitLayout; import forestry.api.core.PluginInfo; +import forestry.api.fuels.FuelManager; import forestry.api.fuels.GeneratorFuel; import forestry.core.GameMode; import forestry.core.circuits.Circuit; @@ -146,10 +148,13 @@ public class PluginEnergy extends NativePlugin { definitionGenerator.register(); definitionEngineClockwork.register(); - GeneratorFuel.fuels.put(LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1).getFluid().getID(), new GeneratorFuel(LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1), - (int) (32 * GameMode.getGameMode().getFloatSetting("fuel.ethanol.generator")), 4)); - GeneratorFuel.fuels.put(LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 1).getFluid().getID(), new GeneratorFuel(LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 1), - (int) (8 * GameMode.getGameMode().getFloatSetting("fuel.biomass.generator")), 1)); + FluidStack ethanol = LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1); + GeneratorFuel ethanolFuel = new GeneratorFuel(ethanol, (int) (32 * GameMode.getGameMode().getFloatSetting("fuel.ethanol.generator")), 4); + FuelManager.generatorFuel.put(ethanol.getFluid(), ethanolFuel); + + FluidStack biomass = LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 1); + GeneratorFuel biomassFuel = new GeneratorFuel(biomass, (int) (8 * GameMode.getGameMode().getFloatSetting("fuel.biomass.generator")), 1); + FuelManager.generatorFuel.put(biomass.getFluid(), biomassFuel); Circuit.energyElectricChoke1 = new CircuitElectricChoke("energyChoke1"); Circuit.energyFireDampener1 = new CircuitFireDampener("energyDampener1");