Added configuration for Farmer

This commit is contained in:
OneEyeMaker 2017-10-04 09:08:05 +03:00
parent 15d3f74c53
commit 55c948f144
9 changed files with 24 additions and 13 deletions

View file

@ -28,6 +28,8 @@ public enum ConfigIntListValues{
CRUSHER_PROCESSING_TIME("Crusher: Processing Time Per Tier", ConfigCategories.MACHINE_RECIPE_COSTS, new int[]{100, 150}, "Time in ticks required to perform one operation in Crusher and Double Crusher."),
EMPOWERER_RECIPE_COSTS("Empowerer: Recipe Energy Cost", ConfigCategories.MACHINE_RECIPE_COSTS, new int[]{5000, 50000, 1000}, "Amount of energy per Display Stand used per tick to craft item in Empowerer.\nOrder of items: Empowered Crystals, Empowered Crystal Blocks, Empowered Canola Seed"),
EMPOWERER_RECIPE_DURATIONS("Empowerer: Recipe Duration", ConfigCategories.MACHINE_RECIPE_COSTS, new int[]{50, 500, 30}, "Time in ticks required to craft item in Empowerer.\nOrder of items: Empowered Crystals, Empowered Crystal Blocks, Empowered Canola Seed"),
FARMER_ENERGY_USE_PER_PLANT("Farmer: Energy Use Per Planting", ConfigCategories.MACHINE_RECIPE_COSTS, new int[]{350, 250, 250, 350, 500, 600}, "Amount of energy used by Farmer to plant crop.\nOrder of crop types: Regular seeds, Cactus, (Sugar) Cane, Melon or Pumpkin, Nether Wart, ExtraUtilities plants (Enderlily/Red Orchid)."),
FARMER_ENERGY_USE_PER_HARVEST("Farmer: Energy Use Per Harvesting", ConfigCategories.MACHINE_RECIPE_COSTS, new int[]{250, 250, 250, 500, 500, 600}, "Amount of energy used by Farmer to harvest crop.\nOrder of crop types: Regular seeds, Cactus, (Sugar) Cane, Melon or Pumpkin, Nether Wart, ExtraUtilities plants (Enderlily/Red Orchid)."),
LASER_RELAY_ENERGY_TRANSFER("Energy Laser Relay: Energy Transfer Rate Per Tier", ConfigCategories.MACHINE_ENERGY_VALUES, new int[]{1000, 10000, 100000}, "Amount of energy each tier of Energy Laser Relay can transfer per tick (per side)."),
LASER_RELAY_ENERGY_LOSS_PERCENTAGE("Energy Laser Relay: Energy Loss Percentage Per Tier", ConfigCategories.MACHINE_ENERGY_VALUES, new int[]{5, 8, 10}, "Energy loss in percents for each tier of Energy Laser Relays, if enabled."),
OIL_GENERATOR_ENERGY_PRODUCTION("Oil Generator: Energy Production", ConfigCategories.MACHINE_ENERGY_VALUES, new int[]{40, 80, 100, 120}, "Amound of energy Oil Generator produces for each oil type.\nThese values change energy density of each type of oil.\nConfig option 'Oil Gen: Power Values' is obsolete, please remove it."),

View file

@ -84,6 +84,8 @@ public enum ConfigIntValues{
ENERGIZER_ENERGY_RECEIVE("Energizer: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Energizer can receive per tick"),
ENERVATOR_ENERGY_CAPACITY("Enervator: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 50000, 1000, 1000000000, "Amount of energy Enervator can store."),
ENERVATOR_ENERGY_SEND("Enervator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Enervator can send per tick"),
FARMER_ENERGY_CAPACITY("Farmer: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 100000, 1000, 1000000000, "Amount of energy Farmer can store."),
FARMER_ENERGY_RECEIVE("Farmer: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Farmer can receive per tick."),
FERMENTING_BARREL_PROCESSING_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."),

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCactus;
import net.minecraft.block.state.IBlockState;
@ -27,7 +28,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 250;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[1];
if(farmer.getEnergy() >= use){
Item item = seed.getItem();
if(item instanceof ItemBlock){
@ -50,7 +51,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 250;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[1];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockCactus){

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
@ -84,7 +85,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 350;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[0];
if(farmer.getEnergy() >= use*2){
if(defaultPlant(world, pos, this.getPlantablePlantFromStack(seed, world, pos), farmer, use)){
return FarmerResult.SUCCESS;
@ -95,7 +96,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 250;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[0];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -28,7 +29,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 350;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[3];
if(farmer.getEnergy() >= use*2){
if(StackUtil.isValid(seed)){
Item seedItem = seed.getItem();
@ -50,7 +51,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 500;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[3];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import net.minecraft.block.Block;
import net.minecraft.block.BlockNetherWart;
import net.minecraft.block.state.IBlockState;
@ -29,7 +30,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 500;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[4];
if(farmer.getEnergy() >= use){
if(seed.getItem() == Items.NETHER_WART){
if(world.getBlockState(pos.down()).getBlock().canSustainPlant(world.getBlockState(pos.down()), world, pos.down(), EnumFacing.UP, (IPlantable) Items.NETHER_WART)){
@ -45,7 +46,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 500;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[4];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockNetherWart){

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import net.minecraft.block.Block;
import net.minecraft.block.BlockReed;
import net.minecraft.block.state.IBlockState;
@ -27,7 +28,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 250;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[2];
if(farmer.getEnergy() >= use){
if(seed.getItem() == Items.REEDS){
if(Blocks.REEDS.canPlaceBlockAt(world, pos)){
@ -43,7 +44,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 250;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[2];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockReed){

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -28,7 +29,7 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
int use = 600;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_PLANT.getValue()[5];
if(farmer.getEnergy() >= use){
if(StackUtil.isValid(seed)){
Item item = seed.getItem();
@ -64,7 +65,7 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
@Override
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
int use = 600;
int use = ConfigIntListValues.FARMER_ENERGY_USE_PER_HARVEST.getValue()[5];
if(farmer.getEnergy() >= use){
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();

View file

@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.state.IBlockState;
@ -32,7 +33,7 @@ import java.util.List;
public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer{
private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<IFarmerBehavior>();
public final CustomEnergyStorage storage = new CustomEnergyStorage(100000, 1000, 0);
public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.FARMER_ENERGY_CAPACITY.getValue(), ConfigIntValues.FARMER_ENERGY_RECEIVE.getValue(), 0);
private int waitTime;
private int checkX;