start on new power api
This commit is contained in:
parent
ea23ef7038
commit
4f80a8c651
35 changed files with 275 additions and 250 deletions
|
@ -99,6 +99,8 @@ dependencies {
|
|||
modCompile ('com.github.Virtuoel:Towelette:519538e54b') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compile 'teamreborn:energy:0.0.5'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -37,10 +37,13 @@ import net.minecraft.util.Tickable;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyStorage;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.cable.BlockCable;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -54,7 +57,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class CableBlockEntity extends BlockEntity
|
||||
implements Tickable, IListInfoProvider, IToolDrop, EnergyBlockEntity {
|
||||
implements Tickable, IListInfoProvider, IToolDrop, EnergyStorage {
|
||||
|
||||
private double energy = 0;
|
||||
private int transferRate = 0;
|
||||
|
@ -124,21 +127,17 @@ public class CableBlockEntity extends BlockEntity
|
|||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
ArrayList<EnergyBlockEntity> acceptors = new ArrayList<EnergyBlockEntity>();
|
||||
ArrayList<BlockEntity> acceptors = new ArrayList<BlockEntity>();
|
||||
for (Direction face : Direction.values()) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
|
||||
|
||||
if (blockEntity == null) {
|
||||
continue;
|
||||
} else if (blockEntity instanceof EnergyBlockEntity) {
|
||||
EnergyBlockEntity acceptor = (EnergyBlockEntity) blockEntity;
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= acceptor.getEnergy()) {
|
||||
} else if (Energy.valid(blockEntity)) {
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(EnergySide.fromMinecraft(face)).getEnergy()) {
|
||||
continue;
|
||||
}
|
||||
if (!acceptor.canAcceptEnergy(face.getOpposite())) {
|
||||
continue;
|
||||
}
|
||||
acceptors.add(acceptor);
|
||||
acceptors.add(blockEntity);
|
||||
if (!sendingFace.contains(face)) {
|
||||
sendingFace.add(face);
|
||||
}
|
||||
|
@ -150,11 +149,9 @@ public class CableBlockEntity extends BlockEntity
|
|||
}
|
||||
Collections.shuffle(acceptors);
|
||||
acceptors.forEach(blockEntity -> {
|
||||
double drain = Math.min(energy, transferRate);
|
||||
if (drain > 0 && blockEntity.addEnergy(drain, true) > 0) {
|
||||
double move = blockEntity.addEnergy(drain, false);
|
||||
useEnergy(move, false);
|
||||
}
|
||||
Energy.of(this)
|
||||
.into(Energy.of(blockEntity))
|
||||
.move();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -176,52 +173,15 @@ public class CableBlockEntity extends BlockEntity
|
|||
return new ItemStack(getCableType().block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public double getEnergy() {
|
||||
return energy;
|
||||
return getStored(EnergySide.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy) {
|
||||
this.energy = energy;
|
||||
setStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return transferRate * 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddEnergy(double energyIn) {
|
||||
return getEnergy() + energyIn <= getMaxPower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double energy) {
|
||||
return addEnergy(energy, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double addEnergy(double energyIn, boolean simulate) {
|
||||
double energyReceived = Math.min(getMaxPower(), Math.min(getMaxPower() - getEnergy(), energyIn));
|
||||
|
||||
if (!simulate) {
|
||||
setEnergy(getEnergy() + energyReceived);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseEnergy(double energy) {
|
||||
return this.energy >= energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(double energy) {
|
||||
return useEnergy(energy, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(double energyOut, boolean simulate) {
|
||||
if (energyOut > energy) {
|
||||
energyOut = energy;
|
||||
|
@ -232,31 +192,40 @@ public class CableBlockEntity extends BlockEntity
|
|||
return energyOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(Direction direction) {
|
||||
if (sendingFace.contains(direction)) {
|
||||
return false;
|
||||
}
|
||||
return getMaxPower() != getEnergy();
|
||||
return getMaxStoredPower() != getEnergy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return transferRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.getTier(cableType.transferRate);
|
||||
public double getMaxStoredPower() {
|
||||
return transferRate * 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return PowerAcceptorBlockEntity.getTier(cableType.transferRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStored(EnergySide face) {
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStored(double amount) {
|
||||
this.energy = amount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,24 +24,24 @@
|
|||
|
||||
package techreborn.blockentity.generator;
|
||||
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRContent.SolarPanels;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
public EnergyTier getTier() {
|
||||
return panel.powerTier;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,15 +27,16 @@ package techreborn.blockentity.storage;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
|
@ -44,7 +45,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
public int superconductors = 0;
|
||||
|
||||
public AdjustableSUBlockEntity() {
|
||||
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, TechRebornConfig.aesuMaxInput, TechRebornConfig.aesuMaxOutput, TechRebornConfig.aesuMaxEnergy);
|
||||
super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxInput, TechRebornConfig.aesuMaxOutput, TechRebornConfig.aesuMaxEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,7 +121,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return OUTPUT;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
|
||||
/**
|
||||
|
@ -46,12 +46,12 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity
|
|||
public RebornInventory<EnergyStorageBlockEntity> inventory;
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier tier;
|
||||
public EnergyTier tier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
public EnergyStorageBlockEntity(BlockEntityType<?> blockEntityType, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
super(blockEntityType);
|
||||
inventory = new RebornInventory<>(invSize, name + "BlockEntity", 64, this);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -42,7 +42,7 @@ public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implement
|
|||
* MFSU should store 40M FE with 2048 FE/t I/O
|
||||
*/
|
||||
public HighVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnumPowerTier.HIGH, 512, 512, 10_000_000);
|
||||
super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 512, 512, 10_000_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -38,7 +38,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class LowVoltageSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
public LowVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnumPowerTier.LOW, 32, 32, 40000);
|
||||
super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 32, 32, 40000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blockentity.storage;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -42,7 +42,7 @@ public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity impleme
|
|||
* MFE should store 1.2M FE with 512 FE/t I/O
|
||||
*/
|
||||
public MediumVoltageSUBlockEntity() {
|
||||
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnumPowerTier.MEDIUM, 128, 128, 300000);
|
||||
super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 128, 128, 300000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,14 +27,14 @@ package techreborn.blockentity.storage.idsu;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blockentity.storage.EnergyStorageBlockEntity;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity implements IContainerProvider {
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
|
|||
private double clientEnergy;
|
||||
|
||||
public InterdimensionalSUBlockEntity() {
|
||||
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnumPowerTier.EXTREME, TechRebornConfig.idsuMaxInput, TechRebornConfig.idsuMaxOutput, TechRebornConfig.idsuMaxEnergy);
|
||||
super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.EXTREME, TechRebornConfig.idsuMaxInput, TechRebornConfig.idsuMaxOutput, TechRebornConfig.idsuMaxEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,10 +29,10 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blockentity.storage.EnergyStorageBlockEntity;
|
||||
import techreborn.blocks.storage.BlockLapotronicSU;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
@ -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, EnumPowerTier.INSANE, 8192, TechRebornConfig.lesuBaseOutput, 1_000_000);
|
||||
super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.INSANE, 8192, TechRebornConfig.lesuBaseOutput, 1_000_000);
|
||||
checkOverfill = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRContent;
|
|||
public class EVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public EVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.EV_TRANSFORMER, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnumPowerTier.INSANE);
|
||||
super(TRBlockEntities.EV_TRANSFORMER, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnergyTier.INSANE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class HVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public HVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnumPowerTier.EXTREME);
|
||||
super(TRBlockEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,7 +34,7 @@ import techreborn.init.TRBlockEntities;
|
|||
public class LVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public LVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnumPowerTier.MEDIUM);
|
||||
super(TRBlockEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnergyTier.MEDIUM);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import techreborn.init.TRContent;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 16/03/2016.
|
||||
|
@ -34,6 +34,6 @@ import techreborn.init.TRBlockEntities;
|
|||
public class MVTransformerBlockEntity extends TransformerBlockEntity {
|
||||
|
||||
public MVTransformerBlockEntity() {
|
||||
super(TRBlockEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnumPowerTier.HIGH);
|
||||
super(TRBlockEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnergyTier.HIGH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,20 +24,21 @@
|
|||
|
||||
package techreborn.blockentity.transformers;
|
||||
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.blocks.transformers.BlockTransformer;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
||||
|
@ -52,20 +53,20 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier inputTier;
|
||||
public EnumPowerTier ouputTier;
|
||||
public EnergyTier inputTier;
|
||||
public EnergyTier ouputTier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TransformerBlockEntity(BlockEntityType<?> blockEntityType, String name, Block wrenchDrop, EnumPowerTier tier) {
|
||||
public TransformerBlockEntity(BlockEntityType<?> blockEntityType, String name, Block wrenchDrop, EnergyTier tier) {
|
||||
super(blockEntityType);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.inputTier = tier;
|
||||
if (tier != EnumPowerTier.MICRO) {
|
||||
ouputTier = EnumPowerTier.values()[tier.ordinal() - 1];
|
||||
if (tier != EnergyTier.MICRO) {
|
||||
ouputTier = EnergyTier.values()[tier.ordinal() - 1];
|
||||
} else {
|
||||
ouputTier = EnumPowerTier.MICRO;
|
||||
ouputTier = EnergyTier.MICRO;
|
||||
}
|
||||
this.name = name;
|
||||
this.maxInput = tier.getMaxInput();
|
||||
|
@ -109,7 +110,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getPushingTier() {
|
||||
public EnergyTier getPushingTier() {
|
||||
return ouputTier;
|
||||
}
|
||||
|
||||
|
@ -137,9 +138,9 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
|
|||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput(EnergySide.UNKNOWN))));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Input Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput(EnergySide.UNKNOWN))));
|
||||
info.add(new LiteralText(Formatting.GRAY + "Output Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ import net.minecraft.world.BlockView;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.util.WrenchUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -112,7 +112,7 @@ public class BlockCable extends BlockWithEntity {
|
|||
|
||||
private Boolean canConnectTo(IWorld world, BlockPos pos, Direction facing) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (blockEntity != null && (blockEntity instanceof EnergyBlockEntity || blockEntity instanceof CableBlockEntity)) {
|
||||
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
|
|
|
@ -40,10 +40,11 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -59,7 +60,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
Item item = stack.getItem();
|
||||
if (item instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) item).addInfo(components, false, false);
|
||||
} else if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||
} else if (stack.getItem() instanceof EnergyHolder) {
|
||||
ItemPowerManager itemPowerManager = new ItemPowerManager(stack);
|
||||
LiteralText line1 = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getEnergyStored()));
|
||||
line1.append("/");
|
||||
|
@ -75,7 +76,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
Formatting color = StringUtils.getPercentageColour(percentage);
|
||||
components.add(2, new LiteralText(color + "" + percentage + "%" + Formatting.GRAY + " Charged"));
|
||||
// TODO: show both input and output rates
|
||||
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((IEnergyItemInfo) item).getMaxInput())));
|
||||
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((EnergyHolder) item).getMaxInput(EnergySide.UNKNOWN))));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
@ -105,4 +106,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
||||
}
|
||||
|
||||
public int percentage(double MaxValue, double CurrentValue) {
|
||||
if (CurrentValue == 0)
|
||||
return 0;
|
||||
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blockentity.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.DigitalChestBlockEntity;
|
||||
|
@ -208,12 +209,12 @@ public class TRContent {
|
|||
public static Item PERIDOT_BOOTS;
|
||||
|
||||
public enum SolarPanels implements ItemConvertible {
|
||||
BASIC(EnumPowerTier.MICRO, TechRebornConfig.basicGenerationRateD, TechRebornConfig.basicGenerationRateN),
|
||||
ADVANCED(EnumPowerTier.LOW, TechRebornConfig.advancedGenerationRateD, TechRebornConfig.advancedGenerationRateN),
|
||||
INDUSTRIAL(EnumPowerTier.MEDIUM, TechRebornConfig.industrialGenerationRateD, TechRebornConfig.industrialGenerationRateN),
|
||||
ULTIMATE(EnumPowerTier.HIGH, TechRebornConfig.ultimateGenerationRateD, TechRebornConfig.ultimateGenerationRateN),
|
||||
QUANTUM(EnumPowerTier.EXTREME, TechRebornConfig.quantumGenerationRateD, TechRebornConfig.quantumGenerationRateN),
|
||||
CREATIVE(EnumPowerTier.INFINITE, Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100);
|
||||
BASIC(EnergyTier.MICRO, TechRebornConfig.basicGenerationRateD, TechRebornConfig.basicGenerationRateN),
|
||||
ADVANCED(EnergyTier.LOW, TechRebornConfig.advancedGenerationRateD, TechRebornConfig.advancedGenerationRateN),
|
||||
INDUSTRIAL(EnergyTier.MEDIUM, TechRebornConfig.industrialGenerationRateD, TechRebornConfig.industrialGenerationRateN),
|
||||
ULTIMATE(EnergyTier.HIGH, TechRebornConfig.ultimateGenerationRateD, TechRebornConfig.ultimateGenerationRateN),
|
||||
QUANTUM(EnergyTier.EXTREME, TechRebornConfig.quantumGenerationRateD, TechRebornConfig.quantumGenerationRateN),
|
||||
CREATIVE(EnergyTier.INFINITE, Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100);
|
||||
|
||||
public final String name;
|
||||
public final Block block;
|
||||
|
@ -224,9 +225,9 @@ public class TRContent {
|
|||
public int generationRateN;
|
||||
// Internal EU storage of solar panel
|
||||
public int internalCapacity;
|
||||
public final EnumPowerTier powerTier;
|
||||
public final EnergyTier powerTier;
|
||||
|
||||
SolarPanels(EnumPowerTier tier, int generationRateD, int generationRateN) {
|
||||
SolarPanels(EnergyTier tier, int generationRateD, int generationRateN) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
powerTier = tier;
|
||||
block = new BlockSolarPanel(this);
|
||||
|
@ -245,15 +246,15 @@ public class TRContent {
|
|||
}
|
||||
|
||||
public enum Cables implements ItemConvertible {
|
||||
COPPER(128, 12.0, true, EnumPowerTier.MEDIUM),
|
||||
TIN(32, 12.0, true, EnumPowerTier.LOW),
|
||||
GOLD(512, 12.0, true, EnumPowerTier.HIGH),
|
||||
HV(2048, 12.0, true, EnumPowerTier.EXTREME),
|
||||
GLASSFIBER(8192, 12.0, false, EnumPowerTier.INSANE),
|
||||
INSULATED_COPPER(128, 10.0, false, EnumPowerTier.MEDIUM),
|
||||
INSULATED_GOLD(512, 10.0, false, EnumPowerTier.HIGH),
|
||||
INSULATED_HV(2048, 10.0, false, EnumPowerTier.EXTREME),
|
||||
SUPERCONDUCTOR(Integer.MAX_VALUE / 4, 10.0, false, EnumPowerTier.INFINITE);
|
||||
COPPER(128, 12.0, true, EnergyTier.MEDIUM),
|
||||
TIN(32, 12.0, true, EnergyTier.LOW),
|
||||
GOLD(512, 12.0, true, EnergyTier.HIGH),
|
||||
HV(2048, 12.0, true, EnergyTier.EXTREME),
|
||||
GLASSFIBER(8192, 12.0, false, EnergyTier.INSANE),
|
||||
INSULATED_COPPER(128, 10.0, false, EnergyTier.MEDIUM),
|
||||
INSULATED_GOLD(512, 10.0, false, EnergyTier.HIGH),
|
||||
INSULATED_HV(2048, 10.0, false, EnergyTier.EXTREME),
|
||||
SUPERCONDUCTOR(Integer.MAX_VALUE / 4, 10.0, false, EnergyTier.INFINITE);
|
||||
|
||||
|
||||
public final String name;
|
||||
|
@ -264,10 +265,10 @@ public class TRContent {
|
|||
public double cableThickness;
|
||||
public boolean canKill;
|
||||
public boolean defaultCanKill;
|
||||
public EnumPowerTier tier;
|
||||
public EnergyTier tier;
|
||||
|
||||
|
||||
Cables(int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier) {
|
||||
Cables(int transferRate, double cableThickness, boolean canKill, EnergyTier tier) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
this.transferRate = transferRate;
|
||||
this.defaultTransferRate = transferRate;
|
||||
|
@ -718,7 +719,7 @@ public class TRContent {
|
|||
handler.addSpeedMulti(TechRebornConfig.overclockerSpeed);
|
||||
handler.addPowerMulti(TechRebornConfig.overclockerPower);
|
||||
if (powerAcceptor != null) {
|
||||
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput();
|
||||
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput(EnergySide.UNKNOWN);
|
||||
powerAcceptor.extraPowerStorage += powerAcceptor.getBaseMaxPower();
|
||||
}
|
||||
}),
|
||||
|
|
|
@ -34,16 +34,18 @@ import net.minecraft.item.ItemGroup;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo {
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder {
|
||||
|
||||
public static int maxCharge = TechRebornConfig.cloakingDeviceCharge;
|
||||
public static int usage = TechRebornConfig.cloackingDeviceUsage;
|
||||
|
@ -102,17 +104,22 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,20 +27,24 @@ package techreborn.items.armor;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemLapotronicOrbpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lapotronPackCharge;
|
||||
|
@ -62,8 +66,7 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
|
|||
@Override
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (entityIn instanceof PlayerEntity) {
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack,
|
||||
(int) transferLimit);
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, transferLimit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,17 +87,12 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return transferLimit;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.EXTREME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,22 +29,26 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRArmorMaterial;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = TechRebornConfig.lithiumBatpackCharge;
|
||||
|
@ -102,17 +106,13 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return transferLimit;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return transferLimit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,24 +32,25 @@ import net.minecraft.item.ItemPropertyGetter;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemBattery extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
private final int maxEnergy;
|
||||
private final EnergyTier tier;
|
||||
|
||||
public ItemBattery(int maxEnergy, int maxTransfer) {
|
||||
public ItemBattery(int maxEnergy, EnergyTier tier) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.tier = tier;
|
||||
this.addPropertyGetter(new Identifier("techreborn:empty"), new ItemPropertyGetter() {
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
@ -80,17 +81,12 @@ public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurability
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return maxTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return maxTransfer;
|
||||
public EnergyTier getTier() {
|
||||
return tier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
|
||||
// 4M FE storage with 1k charge rate
|
||||
public ItemEnergyCrystal() {
|
||||
super(TechRebornConfig.energyCrystalMaxCharge, 1_000);
|
||||
super(TechRebornConfig.energyCrystalMaxCharge, EnergyTier.HIGH);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemLapotronCrystal() {
|
||||
super(TechRebornConfig.lapotronCrystalMaxCharge, 10_000);
|
||||
super(TechRebornConfig.lapotronCrystalMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -37,7 +38,7 @@ public class ItemLapotronicOrb extends ItemBattery {
|
|||
|
||||
// 400M capacity with 100k FE\t charge rate
|
||||
public ItemLapotronicOrb() {
|
||||
super(TechRebornConfig.lapotronicOrbMaxCharge, 100_000);
|
||||
super(TechRebornConfig.lapotronicOrbMaxCharge, EnergyTier.EXTREME);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class ItemLithiumIonBattery extends ItemBattery {
|
|||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemLithiumIonBattery() {
|
||||
super(400_000, 1_000);
|
||||
super(400_000, EnergyTier.HIGH);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class ItemRedCellBattery extends ItemBattery {
|
|||
|
||||
// 40k FE capacity with 100 FE\t charge rate
|
||||
public ItemRedCellBattery() {
|
||||
super(40_000, 100);
|
||||
super(40_000, EnergyTier.LOW);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -35,18 +35,20 @@ import net.minecraft.item.*;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -123,17 +125,22 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.SystemUtil;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.api.power.EnergyBlockEntity;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
@ -65,8 +65,8 @@ public class ItemDebugTool extends Item {
|
|||
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
sendMessage(context, new LiteralText(getBlockEntityType(blockEntity)));
|
||||
if (blockEntity instanceof EnergyBlockEntity) {
|
||||
sendMessage(context, new LiteralText(getRCPower((EnergyBlockEntity) blockEntity)));
|
||||
if (Energy.valid(blockEntity)) {
|
||||
sendMessage(context, new LiteralText(getRCPower(blockEntity)));
|
||||
}
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
|
@ -109,13 +109,13 @@ public class ItemDebugTool extends Item {
|
|||
return s;
|
||||
}
|
||||
|
||||
private String getRCPower(EnergyBlockEntity blockEntity) {
|
||||
private String getRCPower(BlockEntity blockEntity) {
|
||||
String s = "" + Formatting.GREEN;
|
||||
s += "Power: ";
|
||||
s += Formatting.BLUE;
|
||||
s += PowerSystem.getLocaliszedPower(blockEntity.getEnergy());
|
||||
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getEnergy());
|
||||
s += "/";
|
||||
s += PowerSystem.getLocaliszedPower(blockEntity.getMaxPower());
|
||||
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getMaxStored());
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -31,17 +31,19 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -109,17 +111,22 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,16 +35,19 @@ import net.minecraft.item.PickaxeItem;
|
|||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
|
@ -107,17 +110,22 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,19 +35,21 @@ import net.minecraft.item.*;
|
|||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemRockCutter extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.rockCutterCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -144,17 +146,22 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,19 +30,19 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemElectricTreetap extends Item implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = 10_000;
|
||||
public int cost = 20;
|
||||
|
@ -77,17 +77,12 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
return 0;
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.MEDIUM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,11 @@ import com.google.common.collect.Multimap;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import reborncore.api.items.ItemStackModifiers;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -43,13 +41,17 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.items.ItemStackModifiers;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -58,7 +60,7 @@ import techreborn.utils.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public class ItemNanosaber extends SwordItem implements EnergyHolder, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public static final int maxCharge = TechRebornConfig.nanoSaberCharge;
|
||||
public int transferLimit = 1_000;
|
||||
public int cost = 250;
|
||||
|
@ -215,17 +217,22 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,26 +26,28 @@ package techreborn.items.tool.industrial;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DefaultedList;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.ItemPowerManager;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import team.reborn.energy.EnergyHolder;
|
||||
import team.reborn.energy.EnergySide;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -54,7 +56,7 @@ import techreborn.utils.InitUtils;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDurabilityExtensions {
|
||||
public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.omniToolCharge;
|
||||
public int transferLimit = 1_000;
|
||||
|
@ -163,17 +165,22 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
|
|||
|
||||
// IEnergyItemInfo
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInput() {
|
||||
public double getMaxInput(EnergySide side) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxOutput() {
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return EnergyTier.HIGH;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue