Do more configs. Still a lot to go

This commit is contained in:
Prospector 2017-06-09 08:31:19 -07:00
parent cba5fff3c2
commit 2d5d60be6b
23 changed files with 197 additions and 137 deletions

View file

@ -62,8 +62,8 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
*/
double pendingWithdraw = 0.0;
public TileBaseFluidGenerator(EFluidGenerator type, int tier, String tileName, int tankCapacity, int euTick) {
super(tier);
public TileBaseFluidGenerator(EFluidGenerator type, String tileName, int tankCapacity, int euTick) {
super();
recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type);
@ -72,11 +72,6 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
this.euTick = euTick;
}
public TileBaseFluidGenerator(EFluidGenerator type, EnumPowerTier tier, String tileName, int tankCapacity,
int euTick) {
this(type, tier.ordinal(), tileName, tankCapacity, euTick);
}
protected long lastOutput = 0;
private FluidGeneratorRecipe currentRecipe;

View file

@ -46,11 +46,9 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
public static int tankCapacity = 10000;
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorEnergyPerTick", comment = "Diesel Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 20;
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorTier", comment = "Diesel Generator Tier")
public static int tier = 2;
public TileDieselGenerator() {
super(EFluidGenerator.DIESEL, tier, "TileDieselGenerator", tankCapacity, energyPerTick);
super(EFluidGenerator.DIESEL, "TileDieselGenerator", tankCapacity, energyPerTick);
}
@Override

View file

@ -26,17 +26,30 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.api.generator.EFluidGenerator;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileGasTurbine extends TileBaseFluidGenerator implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorMaxOutput", comment = "Gas Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorMaxEnergy", comment = "Gas Generator Max Energy (Value in EU)")
public static int maxEnergy = 1000000;
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorTankCapacity", comment = "Gas Generator Tank Capacity")
public static int tankCapacity = 10000;
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorEnergyPerTick", comment = "Gas Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 16;
public TileGasTurbine() {
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000 * 10, 16);
super(EFluidGenerator.GAS, "TileGasTurbine", tankCapacity, energyPerTick);
}
@Override
@ -46,9 +59,15 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
@Override
public double getBaseMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
return maxEnergy;
}
@Override
public double getBaseMaxOutput() {
return maxOutput;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("gasturbine").player(player.inventory).inventory(8, 84).hotbar(8, 142)

View file

@ -35,14 +35,25 @@ import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Inventory;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorMaxOutput", comment = "Solid Fuel Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorMaxEnergy", comment = "Solid Fuel Generator Max Energy (Value in EU)")
public static int maxEnergy = 10000;
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorEnergyOutput", comment = "Solid Fuel Generator Energy Output Amount (Value in EU)")
public static int outputAmount = 10;
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
public int fuelSlot = 0;
public int burnTime;
@ -130,7 +141,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
@Override
public double getBaseMaxPower() {
return 10000;
return maxEnergy;
}
@Override
@ -145,7 +156,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
@Override
public double getBaseMaxOutput() {
return 64;
return maxOutput;
}
@Override
@ -198,6 +209,6 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
@Override
public int[] getSlotsForFace(EnumFacing side) {
return new int[]{fuelSlot};
return new int[] { fuelSlot };
}
}

View file

@ -32,18 +32,26 @@ import net.minecraft.util.math.BlockPos;
import reborncore.common.IWrenchable;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.config.ConfigTechReborn;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable {
public static final int euTick = ConfigTechReborn.HeatGeneratorOutput;
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorMaxOutput", comment = "Heat Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorMaxEnergy", comment = "Heat Generator Max Energy (Value in EU)")
public static int maxEnergy = 10000;
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorEnergyPerTick", comment = "Heat Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 5;
private long lastOutput = 0;
public TileHeatGenerator() {
super(1);
}
private long lastOutput = 0;
@Override
public void updateEntity() {
@ -51,36 +59,32 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
if (!world.isRemote) {
for (final EnumFacing direction : EnumFacing.values()) {
if(direction.equals(EnumFacing.UP))
if (direction.equals(EnumFacing.UP))
continue;
if (this.world
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
this.getPos().getY() + direction.getFrontOffsetY(),
this.getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
if(tryAddingEnergy(euTick))
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
this.getPos().getY() + direction.getFrontOffsetY(),
this.getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
if (tryAddingEnergy(energyPerTick))
this.lastOutput = this.world.getTotalWorldTime();
}
}
if (this.world.getTotalWorldTime() - this.lastOutput < 30 && !this.isActive())
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
else if (this.world.getTotalWorldTime() - this.lastOutput > 30 && this.isActive())
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, false));
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, false));
}
}
private boolean tryAddingEnergy(int amount)
{
if(this.getMaxPower() - this.getEnergy() >= amount)
{
private boolean tryAddingEnergy(int amount) {
if (this.getMaxPower() - this.getEnergy() >= amount) {
addEnergy(amount);
return true;
}
else if(this.getMaxPower() - this.getEnergy() > 0)
{
} else if (this.getMaxPower() - this.getEnergy() > 0) {
addEnergy(this.getMaxPower() - this.getEnergy());
return true;
}
@ -118,7 +122,7 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
@Override
public double getBaseMaxPower() {
return 10000;
return maxEnergy;
}
@Override
@ -133,7 +137,7 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
@Override
public double getBaseMaxOutput() {
return 64;
return maxOutput;
}
@Override

View file

@ -34,11 +34,23 @@ import net.minecraftforge.oredict.OreDictionary;
import reborncore.common.IWrenchable;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.config.ConfigTechReborn;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileLightningRod extends TilePowerAcceptor implements IWrenchable {
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodMaxOutput", comment = "Lightning Rod Max Output (Value in EU)")
public static int maxOutput = 2048;
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodMaxEnergy", comment = "Lightning Rod Max Energy (Value in EU)")
public static int maxEnergy = 1000000;
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodChanceOfStrike", comment = "Chance of lightning striking a rod (Range: 0-70)")
public static int chanceOfStrike = 24;
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodBaseStrikeEnergy", comment = "Base amount of energy per strike (Value in EU)")
public static int baseEnergyStrike = 32768;
private int onStatusHoldTicks = -1;
public TileLightningRod() {
@ -61,16 +73,16 @@ public class TileLightningRod extends TilePowerAcceptor implements IWrenchable {
final float weatherStrength = this.world.getThunderStrength(1.0F);
if (weatherStrength > 0.2F) {
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
final float lightStrikeChance = (100F - ConfigTechReborn.LightningRodChance) * 20F;
final float lightStrikeChance = (100F - chanceOfStrike) * 20F;
final float totalChance = lightStrikeChance * this.getLightningStrikeMultiplier() * (1.1F - weatherStrength);
if (this.world.rand.nextInt((int) Math.floor(totalChance)) == 0) {
final EntityLightningBolt lightningBolt = new EntityLightningBolt(this.world,
this.pos.getX() + 0.5F,
this.world.provider.getAverageGroundLevel(),
this.pos.getZ() + 0.5F, false);
this.pos.getX() + 0.5F,
this.world.provider.getAverageGroundLevel(),
this.pos.getZ() + 0.5F, false);
this.world.addWeatherEffect(lightningBolt);
this.world.spawnEntity(lightningBolt);
this.addEnergy(32768 * (0.3F + weatherStrength));
this.addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
((BlockMachineBase) this.getBlockType()).setActive(true, this.world, this.pos);
this.onStatusHoldTicks = 400;
}
@ -104,7 +116,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxPower() {
return 327680;
return maxEnergy;
}
@Override
@ -119,7 +131,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxOutput() {
return 2048;
return maxOutput;
}
@Override

View file

@ -26,17 +26,29 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.api.generator.EFluidGenerator;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileSemifluidGenerator extends TileBaseFluidGenerator implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorMaxOutput", comment = "Semifluid Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorMaxEnergy", comment = "Semifluid Generator Max Energy (Value in EU)")
public static int maxEnergy = 1000000;
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorTankCapacity", comment = "Semifluid Generator Tank Capacity")
public static int tankCapacity = 10000;
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorEnergyPerTick", comment = "Semifluid Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 8;
public TileSemifluidGenerator() {
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000 * 10, 8);
super(EFluidGenerator.SEMIFLUID, "TileSemifluidGenerator", tankCapacity, energyPerTick);
}
@Override
@ -44,16 +56,15 @@ public class TileSemifluidGenerator extends TileBaseFluidGenerator implements IC
return new ItemStack(ModBlocks.SEMIFLUID_GENERATOR, 1);
}
@Override
public double getBaseMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
return maxEnergy;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create();
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create();
}
}

View file

@ -29,16 +29,28 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import java.util.List;
/**
* Created by modmuss50 on 25/02/2016.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileSolarPanel extends TilePowerAcceptor implements IWrenchable {
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
public static int maxOutput = 32;
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxEnergy", comment = "Solar Panel Max Energy (Value in EU)")
public static int maxEnergy = 1000;
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelEnergyPerTick", comment = "Solar Panel Energy Per Tick (Value in EU)")
public static int energyPerTick = 1;
boolean shouldMakePower = false;
boolean lastTickSate = false;
@ -57,14 +69,14 @@ public class TileSolarPanel extends TilePowerAcceptor implements IWrenchable {
}
if (this.shouldMakePower) {
this.powerToAdd = 10;
this.powerToAdd = energyPerTick;
this.addEnergy(this.powerToAdd);
} else {
this.powerToAdd = 0;
}
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
}
}
@ -81,12 +93,12 @@ public class TileSolarPanel extends TilePowerAcceptor implements IWrenchable {
public boolean isSunOut() {
return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
&& this.world.isDaytime();
&& this.world.isDaytime();
}
@Override
public double getBaseMaxPower() {
return 1000;
return maxEnergy;
}
@Override
@ -101,7 +113,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxOutput() {
return 32;
return maxOutput;
}
@Override

View file

@ -50,11 +50,9 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
public static int tankCapacity = 10000;
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorEnergyPerTick", comment = "Thermal Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 10;
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorTier", comment = "Thermal Generator Tier")
public static int tier = 2;
public TileThermalGenerator() {
super(EFluidGenerator.THERMAL, tier, "TileThermalGenerator", tankCapacity, energyPerTick);
super(EFluidGenerator.THERMAL, "TileThermalGenerator", tankCapacity, energyPerTick);
}
@Override

View file

@ -30,13 +30,25 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
/**
* Created by modmuss50 on 25/02/2016.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileWaterMill extends TilePowerAcceptor implements IWrenchable {
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillMaxOutput", comment = "Water Mill Max Output (Value in EU)")
public static int maxOutput = 32;
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillMaxEnergy", comment = "Water Mill Max Energy (Value in EU)")
public static int maxEnergy = 1000;
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillEnergyPerTick", comment = "Water Mill Energy Multiplier")
public static int energyMultiplier = 1;
int waterblocks = 0;
public TileWaterMill() {
@ -50,7 +62,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IWrenchable {
this.checkForWater();
}
if (this.waterblocks > 0) {
this.addEnergy(this.waterblocks);
this.addEnergy(this.waterblocks * energyMultiplier);
}
}
@ -65,7 +77,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxPower() {
return 1000;
return maxEnergy;
}
@Override
@ -80,7 +92,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxOutput() {
return 32;
return maxOutput;
}
@Override

View file

@ -29,13 +29,27 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
/**
* Created by modmuss50 on 25/02/2016.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileWindMill extends TilePowerAcceptor implements IWrenchable {
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillMaxOutput", comment = "Wind Mill Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillMaxEnergy", comment = "Wind Mill Max Energy (Value in EU)")
public static int maxEnergy = 10000;
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillEnergyPerTick", comment = "Wind Mill Energy Per Tick (Value in EU)")
public static int baseEnergy = 2;
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillEnergyPerTick", comment = "Wind Mill Thunder Multiplier")
public static double thunderMultiplier = 1.25;
int basePower = 16;
public TileWindMill() {
@ -48,7 +62,7 @@ public class TileWindMill extends TilePowerAcceptor implements IWrenchable {
if (this.pos.getY() > 64) {
int actualPower = this.basePower;
if (this.world.isThundering()) {
actualPower *= 1.25;
actualPower *= thunderMultiplier;
}
this.addEnergy(actualPower); // Value taken from
// http://wiki.industrial-craft.net/?title=Wind_Mill
@ -58,7 +72,7 @@ public class TileWindMill extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxPower() {
return 10000;
return maxEnergy;
}
@Override
@ -73,7 +87,7 @@ public class TileWindMill extends TilePowerAcceptor implements IWrenchable {
@Override
public double getBaseMaxOutput() {
return 128;
return maxOutput;
}
@Override