From caa867769359d75684d85adc94b82765dd98303e Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Sat, 23 Sep 2017 09:21:05 +0300 Subject: [PATCH] Added configuration for Canola Press and Fermenting Barrel --- .../mod/config/values/ConfigIntValues.java | 13 ++++++++++-- .../mod/tile/TileEntityCanolaPress.java | 21 ++++++++++--------- .../mod/tile/TileEntityFermentingBarrel.java | 16 +++++++------- 3 files changed, 31 insertions(+), 19 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 5876e037f..eaf50b453 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 @@ -118,9 +118,18 @@ public enum ConfigIntValues{ EMPOWERER_BLOCK_CREATION_TIME("Empowerer: Empowered Crystal Block Creation Time", ConfigCategories.MACHINE_RECIPE_COSTS, 500, 1, 72000, "Time (in ticks) required to create Empowered Crystal Block in Empowerer"), BIO_REACTOR_ENERGY_CAPACITY("Bio Reactor Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 200000, 1, 1000000000, "Amount of energy Bio Reactor can store"), - BIO_REACTOR_ENERGY_SEND("Bio Reactor Energy Send", ConfigCategories.MACHINE_ENERGY_VALUES, 800, 1, 1000000000, "Amount of energy Bio Reactor can send per tick"), + BIO_REACTOR_ENERGY_SEND("Bio Reactor Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 800, 1, 1000000000, "Amount of energy Bio Reactor can send per tick"), BIO_REACTOR_ENERGY_PER_ITEM("Bio Reactor Energy Generation Per Item", ConfigCategories.MACHINE_ENERGY_VALUES, 2, 1, 1000000, "Amount of energy Bio Reactor per item/per tick; this value will be squared"), - BIO_REACTOR_BURN_TIME("Bio Reactor Base Reaction Time", ConfigCategories.MACHINE_VALUES, 200, 1, 72000, "Base reaction time (in ticks) for one item in Bio Reactor"); + BIO_REACTOR_BURN_TIME("Bio Reactor Base Reaction Time", ConfigCategories.MACHINE_RECIPE_COSTS, 200, 1, 72000, "Base reaction time (in ticks) for one item in Bio Reactor"), + + CANOLA_PRESS_ENERGY_CAPACITY("Canola Press: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 40000, 1, 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_ENERGY_USE("Canola Press: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 35, 1, 1000000000, "Amount of energy used by Canola Press per tick to produce Canola Oil"), + CANOLA_PRESS_PRODUCTION_TIME("Canola Press: Production Time", ConfigCategories.MACHINE_RECIPE_COSTS, 30, 1, 72000, "Time in ticks to create Canola Oil from one item in Canola Press"), + CANOLA_PRESS_PRODUCTION_AMOUNT("Canola Press: Production Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Canola Oil (in mB) produced in Canola Press per item"), + FERMENTING_BARREL_PRODUCTION_TIME("Fermenting Barrel: Production Time", ConfigCategories.MACHINE_RECIPE_COSTS, 100, 1, 72000, "Time in ticks to create Refined Canola Oil in Fermenting Barrel"), + FERMENTING_BARREL_CONSUMPTION_AMOUNT("Fermenting Barrel: Consumption Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Canola Oil (in mB) consumed in Fermenting Barrel per cycle"), + FERMENTING_BARREL_PRODUCTION_AMOUNT("Fermenting Barrel: Production Amount", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 2000, "Amount of Refined Canola Oil (in mB) produced in Fermenting Barrel per cycle"); 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..17ba9889c 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_PRODUCTION_TIME.getValue(); } @SideOnly(Side.CLIENT) @@ -84,16 +83,18 @@ 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 productionAmount = ConfigIntValues.CANOLA_PRESS_PRODUCTION_AMOUNT.getValue(); + int energyUse = ConfigIntValues.CANOLA_PRESS_ENERGY_USE.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 >= ConfigIntValues.CANOLA_PRESS_PRODUCTION_TIME.getValue()){ 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..fdacc1446 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 productionTime = ConfigIntValues.FERMENTING_BARREL_PRODUCTION_TIME.getValue(); + if(this.canolaTank.getFluidAmount() >= productionAmount && productionAmount <= this.oilTank.getCapacity()-this.oilTank.getFluidAmount()){ this.currentProcessTime++; - if(this.currentProcessTime >= PROCESS_TIME){ + if(this.currentProcessTime >= productionTime){ 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_PRODUCTION_TIME.getValue(); } @SideOnly(Side.CLIENT)