Added configuration for Canola Press and Fermenting Barrel

This commit is contained in:
OneEyeMaker 2017-09-23 09:21:05 +03:00
parent e6ba9dc131
commit caa8677693
3 changed files with 31 additions and 19 deletions

View file

@ -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;

View file

@ -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();
}
}

View file

@ -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)