Search in sources :

Example 1 with FermenterFuel

use of forestry.api.fuels.FermenterFuel in project ForestryMC by ForestryMC.

the class TileFermenter method checkFuel.

private void checkFuel() {
    if (fuelBurnTime <= 0) {
        ItemStack fuel = getStackInSlot(InventoryFermenter.SLOT_FUEL);
        if (!fuel.isEmpty()) {
            FermenterFuel fermenterFuel = FuelManager.fermenterFuel.get(fuel);
            if (fermenterFuel != null) {
                fuelBurnTime = fuelTotalTime = fermenterFuel.getBurnDuration();
                fuelCurrentFerment = fermenterFuel.getFermentPerCycle();
                decrStackSize(InventoryFermenter.SLOT_FUEL, 1);
            }
        }
    }
}
Also used : FermenterFuel(forestry.api.fuels.FermenterFuel) ItemStack(net.minecraft.item.ItemStack)

Example 2 with FermenterFuel

use of forestry.api.fuels.FermenterFuel in project ForestryMC by ForestryMC.

the class ModuleFactory method preInit.

@Override
public void preInit() {
    ItemRegistryCore coreItems = ModuleCore.getItems();
    // Set fuels and resources for the fermenter
    ItemStack fertilizerCompound = coreItems.fertilizerCompound.getItemStack();
    FuelManager.fermenterFuel.put(fertilizerCompound, new FermenterFuel(fertilizerCompound, ForestryAPI.activeMode.getIntegerSetting("fermenter.value.fertilizer"), ForestryAPI.activeMode.getIntegerSetting("fermenter.cycles.fertilizer")));
    int cyclesCompost = ForestryAPI.activeMode.getIntegerSetting("fermenter.cycles.compost");
    int valueCompost = ForestryAPI.activeMode.getIntegerSetting("fermenter.value.compost");
    ItemStack fertilizerBio = coreItems.compost.getItemStack();
    ItemStack mulch = coreItems.mulch.getItemStack();
    FuelManager.fermenterFuel.put(fertilizerBio, new FermenterFuel(fertilizerBio, valueCompost, cyclesCompost));
    FuelManager.fermenterFuel.put(mulch, new FermenterFuel(mulch, valueCompost, cyclesCompost));
    // Add moistener resources
    ItemStack wheat = new ItemStack(Items.WHEAT);
    ItemStack mouldyWheat = coreItems.mouldyWheat.getItemStack();
    ItemStack decayingWheat = coreItems.decayingWheat.getItemStack();
    FuelManager.moistenerResource.put(wheat, new MoistenerFuel(wheat, mouldyWheat, 0, 300));
    FuelManager.moistenerResource.put(mouldyWheat, new MoistenerFuel(mouldyWheat, decayingWheat, 1, 600));
    FuelManager.moistenerResource.put(decayingWheat, new MoistenerFuel(decayingWheat, mulch, 2, 900));
    // Set fuels for our own engines
    ItemStack peat = coreItems.peat.getItemStack();
    FuelManager.copperEngineFuel.put(peat, new EngineCopperFuel(peat, Constants.ENGINE_COPPER_FUEL_VALUE_PEAT, Constants.ENGINE_COPPER_CYCLE_DURATION_PEAT));
    ItemStack bituminousPeat = coreItems.bituminousPeat.getItemStack();
    FuelManager.copperEngineFuel.put(bituminousPeat, new EngineCopperFuel(bituminousPeat, Constants.ENGINE_COPPER_FUEL_VALUE_BITUMINOUS_PEAT, Constants.ENGINE_COPPER_CYCLE_DURATION_BITUMINOUS_PEAT));
    Fluid biomass = Fluids.BIOMASS.getFluid();
    if (biomass != null) {
        FuelManager.bronzeEngineFuel.put(biomass, new EngineBronzeFuel(biomass, Constants.ENGINE_FUEL_VALUE_BIOMASS, (int) (Constants.ENGINE_CYCLE_DURATION_BIOMASS * ForestryAPI.activeMode.getFloatSetting("fuel.biomass.biogas")), 1));
    }
    FuelManager.bronzeEngineFuel.put(FluidRegistry.WATER, new EngineBronzeFuel(FluidRegistry.WATER, Constants.ENGINE_FUEL_VALUE_WATER, Constants.ENGINE_CYCLE_DURATION_WATER, 3));
    Fluid milk = Fluids.MILK.getFluid();
    if (milk != null) {
        FuelManager.bronzeEngineFuel.put(milk, new EngineBronzeFuel(milk, Constants.ENGINE_FUEL_VALUE_MILK, Constants.ENGINE_CYCLE_DURATION_MILK, 3));
    }
    Fluid seedOil = Fluids.SEED_OIL.getFluid();
    if (seedOil != null) {
        FuelManager.bronzeEngineFuel.put(seedOil, new EngineBronzeFuel(seedOil, Constants.ENGINE_FUEL_VALUE_SEED_OIL, Constants.ENGINE_CYCLE_DURATION_SEED_OIL, 1));
    }
    Fluid honey = Fluids.FOR_HONEY.getFluid();
    if (honey != null) {
        FuelManager.bronzeEngineFuel.put(honey, new EngineBronzeFuel(honey, Constants.ENGINE_FUEL_VALUE_HONEY, Constants.ENGINE_CYCLE_DURATION_HONEY, 1));
    }
    Fluid juice = Fluids.JUICE.getFluid();
    if (juice != null) {
        FuelManager.bronzeEngineFuel.put(juice, new EngineBronzeFuel(juice, Constants.ENGINE_FUEL_VALUE_JUICE, Constants.ENGINE_CYCLE_DURATION_JUICE, 1));
    }
    // Set rain substrates
    ItemStack iodineCharge = coreItems.iodineCharge.getItemStack();
    ItemStack dissipationCharge = coreItems.craftingMaterial.getDissipationCharge();
    FuelManager.rainSubstrate.put(iodineCharge, new RainSubstrate(iodineCharge, Constants.RAINMAKER_RAIN_DURATION_IODINE, 0.01f));
    FuelManager.rainSubstrate.put(dissipationCharge, new RainSubstrate(dissipationCharge, 0.075f));
    ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade", CircuitSocketType.MACHINE);
    ChipsetManager.circuitRegistry.registerLayout(layoutMachineUpgrade);
}
Also used : ICircuitLayout(forestry.api.circuits.ICircuitLayout) EngineCopperFuel(forestry.api.fuels.EngineCopperFuel) ItemRegistryCore(forestry.core.items.ItemRegistryCore) MoistenerFuel(forestry.api.fuels.MoistenerFuel) Fluid(net.minecraftforge.fluids.Fluid) FermenterFuel(forestry.api.fuels.FermenterFuel) EngineBronzeFuel(forestry.api.fuels.EngineBronzeFuel) RainSubstrate(forestry.api.fuels.RainSubstrate) ICircuitLayout(forestry.api.circuits.ICircuitLayout) CircuitLayout(forestry.core.circuits.CircuitLayout) ItemStack(net.minecraft.item.ItemStack)

Example 3 with FermenterFuel

use of forestry.api.fuels.FermenterFuel in project ForestryMC by ForestryMC.

the class FermenterRecipeWrapper method getIngredients.

@Override
public void getIngredients(IIngredients ingredients) {
    List<ItemStack> fuelInputs = new ArrayList<>();
    for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
        fuelInputs.add(fuel.getItem());
    }
    ingredients.setInputLists(ItemStack.class, Arrays.asList(Collections.singletonList(fermentable), fuelInputs));
    FluidStack fluidInput = getRecipe().getFluidResource().copy();
    fluidInput.amount = getRecipe().getFermentationValue();
    ingredients.setInput(FluidStack.class, fluidInput);
    int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
    if (fermentable.getItem() instanceof IVariableFermentable) {
        amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
    }
    FluidStack fluidOutput = new FluidStack(getRecipe().getOutput(), amount);
    ingredients.setOutput(FluidStack.class, fluidOutput);
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IVariableFermentable(forestry.api.recipes.IVariableFermentable) ArrayList(java.util.ArrayList) FermenterFuel(forestry.api.fuels.FermenterFuel) ItemStack(net.minecraft.item.ItemStack)

Aggregations

FermenterFuel (forestry.api.fuels.FermenterFuel)3 ItemStack (net.minecraft.item.ItemStack)3 ICircuitLayout (forestry.api.circuits.ICircuitLayout)1 EngineBronzeFuel (forestry.api.fuels.EngineBronzeFuel)1 EngineCopperFuel (forestry.api.fuels.EngineCopperFuel)1 MoistenerFuel (forestry.api.fuels.MoistenerFuel)1 RainSubstrate (forestry.api.fuels.RainSubstrate)1 IVariableFermentable (forestry.api.recipes.IVariableFermentable)1 CircuitLayout (forestry.core.circuits.CircuitLayout)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1 ArrayList (java.util.ArrayList)1 Fluid (net.minecraftforge.fluids.Fluid)1 FluidStack (net.minecraftforge.fluids.FluidStack)1