Added configuration for Canola Press and Fermenting Barrel

This commit is contained in:
OneEyeMaker 2017-09-26 08:26:21 +03:00
parent 152a97616e
commit e019692399
3 changed files with 30 additions and 18 deletions

View file

@ -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_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."), 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_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 name;
public final String category; public final String category;

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile; 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.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; 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 class TileEntityCanolaPress extends TileEntityInventoryBase implements ISharingFluidHandler{
public static final int PRODUCE = 80; public final CustomEnergyStorage storage;
public static final int ENERGY_USE = 35;
private static final int TIME = 30;
public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0);
public final FluidTank tank = new FluidTank(2*Util.BUCKET){ public final FluidTank tank = new FluidTank(2*Util.BUCKET){
@Override @Override
public boolean canFill(){ public boolean canFill(){
@ -43,6 +41,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS
public TileEntityCanolaPress(){ public TileEntityCanolaPress(){
super(1, "canolaPress"); super(1, "canolaPress");
this.storage = new CustomEnergyStorage(ConfigIntValues.CANOLA_PRESS_ENERGY_CAPACITY.getValue(), ConfigIntValues.CANOLA_PRESS_ENERGY_RECEIVE.getValue(), 0);
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -52,7 +51,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getProcessScaled(int i){ public int getProcessScaled(int i){
return this.currentProcessTime*i/TIME; return this.currentProcessTime*i/ConfigIntValues.CANOLA_PRESS_RECIPE_DURATION.getValue();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -84,16 +83,19 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
if(!this.world.isRemote){ if(!this.world.isRemote){
if(this.isCanola(0) && PRODUCE <= this.tank.getCapacity()-this.tank.getFluidAmount()){ int energyUse = ConfigIntValues.CANOLA_PRESS_RECIPE_COST.getValue();
if(this.storage.getEnergyStored() >= ENERGY_USE){ 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.currentProcessTime++;
this.storage.extractEnergyInternal(ENERGY_USE, false); this.storage.extractEnergyInternal(energyUse, false);
if(this.currentProcessTime >= TIME){ if(this.currentProcessTime >= processingTime){
this.currentProcessTime = 0; this.currentProcessTime = 0;
this.slots.setStackInSlot(0, StackUtil.addStackSize(this.slots.getStackInSlot(0), -1)); 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(); this.markDirty();
} }
} }

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile; 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.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -23,7 +24,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler{ public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler{
private static final int PROCESS_TIME = 100;
public final FluidTank canolaTank = new FluidTank(2*Util.BUCKET){ public final FluidTank canolaTank = new FluidTank(2*Util.BUCKET){
@Override @Override
public boolean canDrain(){ public boolean canDrain(){
@ -82,14 +82,16 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
if(!this.world.isRemote){ if(!this.world.isRemote){
int produce = 80; int consumptionAmount = ConfigIntValues.FERMENTING_BARREL_CONSUMPTION_AMOUNT.getValue();
if(this.canolaTank.getFluidAmount() >= produce && produce <= this.oilTank.getCapacity()-this.oilTank.getFluidAmount()){ 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++; this.currentProcessTime++;
if(this.currentProcessTime >= PROCESS_TIME){ if(this.currentProcessTime >= processingTime){
this.currentProcessTime = 0; this.currentProcessTime = 0;
this.oilTank.fillInternal(new FluidStack(InitFluids.fluidRefinedCanolaOil, produce), true); this.oilTank.fillInternal(new FluidStack(InitFluids.fluidRefinedCanolaOil, productionAmount), true);
this.canolaTank.drainInternal(produce, true); this.canolaTank.drainInternal(consumptionAmount, true);
} }
} }
else{ else{
@ -119,7 +121,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getProcessScaled(int i){ public int getProcessScaled(int i){
return this.currentProcessTime*i/PROCESS_TIME; return this.currentProcessTime*i/ ConfigIntValues.FERMENTING_BARREL_RECIPE_DURATION.getValue();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)