Moved GeneratorFuel list to FuelManager

This commit is contained in:
mezz committed 2014-09-18 19:09:59 -07:00
1 parent 0c6ed6286d
commit 4b7619355d
4 files changed
+19 -12

No files matched your search

+2
View File
@@ -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<RainSubstrate>();
FuelManager.bronzeEngineFuel = new FluidMap<EngineBronzeFuel>();
FuelManager.copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
}
@SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore")
public static ForestryCore core = new ForestryCore();
@@ -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);
@@ -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");