More configs & start fixing cable models

This commit is contained in:
Prospector 2017-06-08 19:12:58 -07:00
parent ad36dfcddb
commit 2b7868c651
46 changed files with 738 additions and 309 deletions

View file

@ -87,7 +87,7 @@ public class TileCreativePanel extends TilePowerAcceptor implements IWrenchable
@Override
public EnumPowerTier getBaseTier() {
return EnumPowerTier.LOW;
return EnumPowerTier.INFINITE;
}
@Override

View file

@ -26,21 +26,32 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.api.power.EnumPowerTier;
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 TileDieselGenerator extends TileBaseFluidGenerator implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorMaxOutput", comment = "Diesel Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorMaxEnergy", comment = "Diesel Generator Max Energy (Value in EU)")
public static int maxEnergy = 1000000;
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorTankCapacity", comment = "Diesel Generator Tank Capacity")
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, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000 * 10,
ConfigTechReborn.ThermalGeneratorOutput);
super(EFluidGenerator.DIESEL, tier, "TileDieselGenerator", tankCapacity, energyPerTick);
}
@Override
@ -50,23 +61,23 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
@Override
public double getBaseMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
return maxEnergy;
}
@Override
public double getBaseMaxOutput() {
return 64;
return maxOutput;
}
@Override
public EnumPowerTier getBaseTier() {
return EnumPowerTier.LOW;
return EnumPowerTier.MEDIUM;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("dieselgenerator").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

@ -34,50 +34,56 @@ 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.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
public static final int euTick = ConfigTechReborn.DragonEggSiphonerOutput;
public Inventory inventory = new Inventory(3, "TileAlloySmelter", 64, this);
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxOutput", comment = "Dragon Egg Siphoner Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxEnergy", comment = "Dragon Egg Siphoner Max Energy (Value in EU)")
public static int maxEnergy = 1000;
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerEnergyPerTick", comment = "Dragon Egg Siphoner Energy Per Tick (Value in EU)")
public static int energyPerTick = 4;
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerTier", comment = "Dragon Egg Siphoner Tier")
public static int tier = 2;
public Inventory inventory = new Inventory(3, "TileDragonEggSiphoner", 64, this);
private long lastOutput = 0;
public TileDragonEggSiphoner() {
super(2);
super(tier);
}
private long lastOutput = 0;
@Override
public void updateEntity() {
super.updateEntity();
if (!world.isRemote) {
if (world.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
.getBlock() == Blocks.DRAGON_EGG) {
if(tryAddingEnergy(euTick))
.getBlock() == Blocks.DRAGON_EGG) {
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;
}
@ -115,7 +121,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
@Override
public double getBaseMaxPower() {
return 1000;
return maxEnergy;
}
@Override
@ -130,7 +136,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
@Override
public double getBaseMaxOutput() {
return euTick;
return maxOutput;
}
@Override
@ -140,7 +146,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
@Override
public EnumPowerTier getBaseTier() {
return EnumPowerTier.HIGH;
return EnumPowerTier.MEDIUM;
}
@Override

View file

@ -29,22 +29,33 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.api.power.EnumPowerTier;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.FluidUtils;
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 TileThermalGenerator extends TileBaseFluidGenerator implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorMaxOutput", comment = "Thermal Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorMaxEnergy", comment = "Thermal Generator Max Energy (Value in EU)")
public static int maxEnergy = 1000000;
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorTankCapacity", comment = "Thermal Generator Tank Capacity")
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, ConfigTechReborn.ThermalGeneratorTier, "TileThermalGenerator", 1000 * 10,
ConfigTechReborn.ThermalGeneratorOutput);
super(EFluidGenerator.THERMAL, tier, "TileThermalGenerator", tankCapacity, energyPerTick);
}
@Override
@ -61,10 +72,10 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
this.syncWithAll();
for (final EnumFacing direction : EnumFacing.values()) {
if (this.world
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
this.getPos().getY() + direction.getFrontOffsetY(),
this.getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
this.getPos().getY() + direction.getFrontOffsetY(),
this.getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
if (this.tryAddingEnergy(1))
this.lastOutput = this.world.getTotalWorldTime();
}
@ -74,23 +85,23 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
@Override
public double getBaseMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
return maxEnergy;
}
@Override
public double getBaseMaxOutput() {
return 128;
return maxOutput;
}
@Override
public EnumPowerTier getBaseTier() {
return EnumPowerTier.LOW;
return EnumPowerTier.MEDIUM;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("thermalgenerator").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();
}
}