Lineup batteries and energy storages.

This commit is contained in:
drcrazy 2020-01-13 15:35:59 +03:00
parent b9c8a1a215
commit 342043dbba
10 changed files with 50 additions and 64 deletions

View file

@ -45,12 +45,15 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
public int superconductors = 0;
public AdjustableSUBlockEntity() {
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxInput, TechRebornConfig.aesuMaxOutput, TechRebornConfig.aesuMaxEnergy);
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxEnergy);
}
@Override
public void tick() {
super.tick();
if (world == null){
return;
}
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
@ -97,7 +100,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
toTag(blockEntity);
dropStack.setTag(new CompoundTag());
dropStack.getTag().put("blockEntity", blockEntity);
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
return dropStack;
}

View file

@ -51,14 +51,14 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
public int maxOutput;
public int maxStorage;
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxInput, int maxOuput, int maxStorage) {
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxStorage) {
super(blockEntityType);
inventory = new RebornInventory<>(invSize, name + "BlockEntity", 64, this);
this.wrenchDrop = wrenchDrop;
this.tier = tier;
this.name = name;
this.maxInput = maxInput;
this.maxOutput = maxOuput;
this.maxInput = tier.getMaxInput();
this.maxOutput = tier.getMaxOutput();
this.maxStorage = maxStorage;
// Call it again after we have proper values for energy I\O
checkTier();
@ -76,11 +76,8 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
if (Energy.valid(stack)) {
Energy.of(this)
.into(
Energy
.of(stack)
)
.move();
.into(Energy.of(stack))
.move(tier.getMaxInput());
}
}
if (!inventory.getInvStack(1).isEmpty()) {

View file

@ -39,10 +39,10 @@ import techreborn.init.TRContent;
public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
/**
* MFSU should store 40M FE with 2048 FE/t I/O
* MFSU should store 4M Energy with 512 E/t I/O
*/
public HighVoltageSUBlockEntity() {
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 512, 512, 10_000_000);
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 4_000_000);
}
@Override

View file

@ -38,7 +38,7 @@ import techreborn.init.TRContent;
public class LowVoltageSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
public LowVoltageSUBlockEntity() {
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 32, 32, 40000);
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 40_000);
}
@Override

View file

@ -39,10 +39,10 @@ import techreborn.init.TRContent;
public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
/**
* MFE should store 1.2M FE with 512 FE/t I/O
* MFE should store 300k energy with 128 E/t I/O
*/
public MediumVoltageSUBlockEntity() {
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 128, 128, 300000);
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 300_000);
}
@Override

View file

@ -45,7 +45,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
private double clientEnergy;
public InterdimensionalSUBlockEntity() {
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.EXTREME, TechRebornConfig.idsuMaxInput, TechRebornConfig.idsuMaxOutput, TechRebornConfig.idsuMaxEnergy);
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.INSANE, TechRebornConfig.idsuMaxEnergy);
}
@Override

View file

@ -47,7 +47,7 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<>();
public LapotronicSUBlockEntity() {
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.INSANE, 8192, TechRebornConfig.lesuBaseOutput, 1_000_000);
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.LOW, 1_000_000);
checkOverfill = false;
}
@ -80,7 +80,7 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements
}
setMaxStorage();
maxOutput = (connectedBlocks * TechRebornConfig.lesuExtraIOPerBlock) + TechRebornConfig.lesuBaseOutput;
maxOutput = (connectedBlocks * TechRebornConfig.lesuExtraIOPerBlock) + tier.getMaxOutput();
if (getEnergy() > getMaxStoredPower()) {
setEnergy(getMaxStoredPower());

View file

@ -253,20 +253,20 @@ public class TechRebornConfig {
@Config(config = "items", category = "power", key = "LithiumBatpackCharge", comment = "Energy Capacity for Lithium Batpack")
public static int lithiumBatpackCharge = 600_000;
@Config(config = "items", category = "power", key = "redCellBatteryMaxCharge", comment = "Energy Capacity for Red Cell Battery (FE)")
public static int redCellBatteryMaxCharge = 40_000;
@Config(config = "items", category = "power", key = "redCellBatteryMaxCharge", comment = "Energy Capacity for Red Cell Battery")
public static int redCellBatteryMaxCharge = 10_000;
@Config(config = "items", category = "power", key = "lithiumIonBatteryMaxCharge", comment = "Energy Capacity for Lithium Ion Battery (FE)")
public static int lithiumIonBatteryMaxCharge = 400_000;
@Config(config = "items", category = "power", key = "lithiumIonBatteryMaxCharge", comment = "Energy Capacity for Lithium Ion Battery")
public static int lithiumIonBatteryMaxCharge = 100_000;
@Config(config = "items", category = "power", key = "energyCrystalMaxCharge", comment = "Energy Capacity for Energy Crystal (FE)")
public static int energyCrystalMaxCharge = 4_000_000;
@Config(config = "items", category = "power", key = "energyCrystalMaxCharge", comment = "Energy Capacity for Energy Crystal")
public static int energyCrystalMaxCharge = 1_000_000;
@Config(config = "items", category = "power", key = "lapotronCrystalMaxCharge", comment = "Energy Capacity for Lapotron Crystal (FE)")
public static int lapotronCrystalMaxCharge = 40_000_000;
@Config(config = "items", category = "power", key = "lapotronCrystalMaxCharge", comment = "Energy Capacity for Lapotron Crystal")
public static int lapotronCrystalMaxCharge = 10_000_000;
@Config(config = "items", category = "power", key = "lapotronicOrbMaxCharge", comment = "Energy Capacity for Lapotronic Orb (FE)")
public static int lapotronicOrbMaxCharge = 400_000_000;
@Config(config = "items", category = "power", key = "lapotronicOrbMaxCharge", comment = "Energy Capacity for Lapotronic Orb")
public static int lapotronicOrbMaxCharge = 100_000_000;
@Config(config = "items", category = "power", key = "cloakingDeviceCharge", comment = "Energy Capacity for Clocking Device (FE)")
public static int cloakingDeviceCharge = 40_000_000;
@ -309,22 +309,13 @@ public class TechRebornConfig {
@Config(config = "machines", category = "grinder", key = "GrinderMaxEnergy", comment = "Grinder Max Energy (Value in EU)")
public static int grinderMaxEnergy = 1_000;
@Config(config = "machines", category = "lesu", key = "LesuMaxOutput", comment = "LESU Base Output (Value in EU)")
public static int lesuBaseOutput = 16;
@Config(config = "machines", category = "lesu", key = "LesuMaxEnergyPerBlock", comment = "LESU Max Energy Per Block (Value in EU)")
@Config(config = "machines", category = "lesu", key = "LesuMaxEnergyPerBlock", comment = "LESU Max Energy Per Block")
public static int lesuStoragePerBlock = 1_000_000;
@Config(config = "machines", category = "lesu", key = "LesuExtraIO", comment = "LESU Extra I/O Multiplier")
public static int lesuExtraIOPerBlock = 8;
@Config(config = "machines", category = "aesu", key = "AesuMaxInput", comment = "AESU Max Input (Value in EU)")
public static int aesuMaxInput = 16192;
@Config(config = "machines", category = "aesu", key = "AesuMaxOutput", comment = "AESU Max Output (Value in EU)")
public static int aesuMaxOutput = 16192;
@Config(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)")
@Config(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy")
public static int aesuMaxEnergy = 100_000_000;
@Config(config = "machines", category = "player_detector", key = "PlayerDetectorMaxInput", comment = "Player Detector Max Input (Value in EU)")
@ -495,14 +486,8 @@ public class TechRebornConfig {
@Config(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxEnergy", comment = "Chemical Reactor Max Energy (Value in EU)")
public static int chemicalReactorMaxEnergy = 10_000;
@Config(config = "machines", category = "idsu", key = "IdsuMaxInput", comment = "IDSU Max Input (Value in EU)")
public static int idsuMaxInput = 8192;
@Config(config = "machines", category = "idsu", key = "IdsuMaxOutput", comment = "IDSU Max Output (Value in EU)")
public static int idsuMaxOutput = 8192;
@Config(config = "machines", category = "idsu", key = "IdsuMaxEnergy", comment = "IDSU Max Energy (Value in EU)")
public static int idsuMaxEnergy = 100_000_000;
@Config(config = "machines", category = "idsu", key = "IdsuMaxEnergy", comment = "IDSU Max Energy")
public static int idsuMaxEnergy = 1_000_000_000;
@Config(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxInput", comment = "Fusion Reactor Max Input (Value in EU)")
public static int fusionControlComputerMaxInput = 8192;

View file

@ -166,11 +166,11 @@ public class ModRegistry {
// Battery
RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.redCellBatteryMaxCharge, EnergyTier.LOW), "red_cell_battery"));
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.lithiumIonBatteryMaxCharge, EnergyTier.HIGH), "lithium_ion_battery"));
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.lithiumIonBatteryMaxCharge, EnergyTier.MEDIUM), "lithium_ion_battery"));
RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new BatpackItem(TechRebornConfig.lithiumBatpackCharge, TRArmorMaterials.LITHIUM_BATPACK, EnergyTier.MEDIUM), "lithium_ion_batpack"));
RebornRegistry.registerItem(TRContent.ENERGY_CRYSTAL = InitUtils.setup(new BatteryItem(TechRebornConfig.energyCrystalMaxCharge, EnergyTier.HIGH), "energy_crystal"));
RebornRegistry.registerItem(TRContent.LAPOTRON_CRYSTAL = InitUtils.setup(new BatteryItem(TechRebornConfig.lapotronCrystalMaxCharge, EnergyTier.EXTREME), "lapotron_crystal"));
RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new BatteryItem(TechRebornConfig.lapotronicOrbMaxCharge, EnergyTier.EXTREME), "lapotronic_orb"));
RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new BatteryItem(TechRebornConfig.lapotronicOrbMaxCharge, EnergyTier.INSANE), "lapotronic_orb"));
RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new BatpackItem(TechRebornConfig.lapotronPackCharge, TRArmorMaterials.LAPOTRONIC_ORBPACK, EnergyTier.INSANE), "lapotronic_orbpack"));
// Tools

View file

@ -56,21 +56,6 @@ public class BatteryItem extends Item implements EnergyHolder, ItemDurabilityExt
}
// Item
@Override
public double getDurability(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
}
@Override
public boolean showDurability(ItemStack stack) {
return true;
}
@Override
public int getDurabilityColor(ItemStack stack) {
return PowerSystem.getDisplayPower().colour;
}
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
if (!isIn(group)) {
@ -89,4 +74,20 @@ public class BatteryItem extends Item implements EnergyHolder, ItemDurabilityExt
public EnergyTier getTier() {
return tier;
}
// ItemDurabilityExtensions
@Override
public double getDurability(ItemStack stack) {
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
}
@Override
public boolean showDurability(ItemStack stack) {
return true;
}
@Override
public int getDurabilityColor(ItemStack stack) {
return PowerSystem.getDisplayPower().colour;
}
}