From e019692399b2455a9c2121b9f7316a60ae1c7b21 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Tue, 26 Sep 2017 08:26:21 +0300 Subject: [PATCH] Added configuration for Canola Press and Fermenting Barrel --- .../mod/config/values/ConfigIntValues.java | 10 ++++++++- .../mod/tile/TileEntityCanolaPress.java | 22 ++++++++++--------- .../mod/tile/TileEntityFermentingBarrel.java | 16 ++++++++------ 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java index 99659da78..ccd11897c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java @@ -58,7 +58,15 @@ public enum ConfigIntValues{ ATOMIC_RECONSTRUCTOR_ENERGY_RECEIVE("Atomic Reconstructor: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 5000, 1, 1000000000, "Amount of energy Atomic Reconstructor can receive per tick."), ATOMIC_RECONSTRUCTOR_ENERGY_USE("Atomic Reconstructor: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Basic amount of energy Atomic Reconstructor uses per craft."), DISPLAY_STAND_ENERGY_CAPACITY("Display Stand: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 80000, 1000, 1000000000, "Amount of energy Display Stand can store."), - DISPLAY_STAND_ENERGY_RECEIVE("Display Stand: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Display Stand can receive per tick."); + DISPLAY_STAND_ENERGY_RECEIVE("Display Stand: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Display Stand can receive per tick."), + CANOLA_PRESS_ENERGY_CAPACITY("Canola Press: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 40000, 1000, 1000000000, "Amount of energy Canola Press can store."), + CANOLA_PRESS_ENERGY_RECEIVE("Canola Press: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 100, 1, 1000000000, "Amount of energy Canola Press can receive per tick."), + CANOLA_PRESS_RECIPE_COST("Canola Press: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 35, 1, 1000000000, "Amount of energy Canola Press uses to extract Canola Oil from one item."), + CANOLA_PRESS_RECIPE_DURATION("Canola Press: Processing Duration", ConfigCategories.MACHINE_RECIPE_COSTS, 30, 1, 72000, "Time in ticks required to process one Canola in Canola Press."), + CANOLA_PRESS_PRODUCTION_AMOUNT("Canola Press: Production Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Canola Oil (in mB) Canola Press produces from one Canola."), + FERMENTING_BARREL_RECIPE_DURATION("Fermenting Barrel: Processing Duration", ConfigCategories.MACHINE_RECIPE_COSTS, 100, 1, 72000, "Time in ticks required for one operation in Fermenting Barrel."), + FERMENTING_BARREL_CONSUMPTION_AMOUNT("Fermenting Barrel: Consumption Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Canola Oil (in mB) Fermenting Barrel uses per operation."), + FERMENTING_BARREL_PRODUCTION_AMOUNT("Fermenting Barrel: Production Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Refined Canola Oil Fermenting Barrel produces per operation."); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index 8c71632dd..efba6b295 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; @@ -26,10 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityCanolaPress extends TileEntityInventoryBase implements ISharingFluidHandler{ - public static final int PRODUCE = 80; - public static final int ENERGY_USE = 35; - private static final int TIME = 30; - public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0); + public final CustomEnergyStorage storage; public final FluidTank tank = new FluidTank(2*Util.BUCKET){ @Override public boolean canFill(){ @@ -43,6 +41,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS public TileEntityCanolaPress(){ super(1, "canolaPress"); + this.storage = new CustomEnergyStorage(ConfigIntValues.CANOLA_PRESS_ENERGY_CAPACITY.getValue(), ConfigIntValues.CANOLA_PRESS_ENERGY_RECEIVE.getValue(), 0); } @SideOnly(Side.CLIENT) @@ -52,7 +51,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS @SideOnly(Side.CLIENT) public int getProcessScaled(int i){ - return this.currentProcessTime*i/TIME; + return this.currentProcessTime*i/ConfigIntValues.CANOLA_PRESS_RECIPE_DURATION.getValue(); } @SideOnly(Side.CLIENT) @@ -84,16 +83,19 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS public void updateEntity(){ super.updateEntity(); if(!this.world.isRemote){ - if(this.isCanola(0) && PRODUCE <= this.tank.getCapacity()-this.tank.getFluidAmount()){ - if(this.storage.getEnergyStored() >= ENERGY_USE){ + int energyUse = ConfigIntValues.CANOLA_PRESS_RECIPE_COST.getValue(); + int productionAmount = ConfigIntValues.CANOLA_PRESS_PRODUCTION_AMOUNT.getValue(); + int processingTime = ConfigIntValues.CANOLA_PRESS_RECIPE_DURATION.getValue(); + if(this.isCanola(0) && productionAmount <= this.tank.getCapacity()-this.tank.getFluidAmount()){ + if(this.storage.getEnergyStored() >= energyUse){ this.currentProcessTime++; - this.storage.extractEnergyInternal(ENERGY_USE, false); - if(this.currentProcessTime >= TIME){ + this.storage.extractEnergyInternal(energyUse, false); + if(this.currentProcessTime >= processingTime){ this.currentProcessTime = 0; this.slots.setStackInSlot(0, StackUtil.addStackSize(this.slots.getStackInSlot(0), -1)); - this.tank.fillInternal(new FluidStack(InitFluids.fluidCanolaOil, PRODUCE), true); + this.tank.fillInternal(new FluidStack(InitFluids.fluidCanolaOil, productionAmount), true); this.markDirty(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 8e9c22033..59a4f0256 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.nbt.NBTTagCompound; @@ -23,7 +24,6 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler{ - private static final int PROCESS_TIME = 100; public final FluidTank canolaTank = new FluidTank(2*Util.BUCKET){ @Override public boolean canDrain(){ @@ -82,14 +82,16 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari public void updateEntity(){ super.updateEntity(); if(!this.world.isRemote){ - int produce = 80; - if(this.canolaTank.getFluidAmount() >= produce && produce <= this.oilTank.getCapacity()-this.oilTank.getFluidAmount()){ + int consumptionAmount = ConfigIntValues.FERMENTING_BARREL_CONSUMPTION_AMOUNT.getValue(); + int productionAmount = ConfigIntValues.FERMENTING_BARREL_PRODUCTION_AMOUNT.getValue(); + int processingTime = ConfigIntValues.FERMENTING_BARREL_RECIPE_DURATION.getValue(); + if(this.canolaTank.getFluidAmount() >= productionAmount && productionAmount <= this.oilTank.getCapacity()-this.oilTank.getFluidAmount()){ this.currentProcessTime++; - if(this.currentProcessTime >= PROCESS_TIME){ + if(this.currentProcessTime >= processingTime){ this.currentProcessTime = 0; - this.oilTank.fillInternal(new FluidStack(InitFluids.fluidRefinedCanolaOil, produce), true); - this.canolaTank.drainInternal(produce, true); + this.oilTank.fillInternal(new FluidStack(InitFluids.fluidRefinedCanolaOil, productionAmount), true); + this.canolaTank.drainInternal(consumptionAmount, true); } } else{ @@ -119,7 +121,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari @SideOnly(Side.CLIENT) public int getProcessScaled(int i){ - return this.currentProcessTime*i/PROCESS_TIME; + return this.currentProcessTime*i/ ConfigIntValues.FERMENTING_BARREL_RECIPE_DURATION.getValue(); } @SideOnly(Side.CLIENT)