diff --git a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java index bad2972f6..6bf667b8a 100644 --- a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java +++ b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java @@ -44,7 +44,7 @@ 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.blocks.cable.CableBlock; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; @@ -68,11 +68,22 @@ public class CableBlockEntity extends BlockEntity public CableBlockEntity() { super(TRBlockEntities.CABLE); } + + public CableBlockEntity(TRContent.Cables type) { + super(TRBlockEntities.CABLE); + this.cableType = type; + } private TRContent.Cables getCableType() { + if (cableType != null) { + return cableType; + } + if (world == null) { + return TRContent.Cables.COPPER; + } Block block = world.getBlockState(pos).getBlock(); - if(block instanceof BlockCable){ - return ((BlockCable) block).type; + if(block instanceof CableBlock){ + return ((CableBlock) block).type; } //Something has gone wrong if this happens return TRContent.Cables.COPPER; @@ -161,13 +172,11 @@ public class CableBlockEntity extends BlockEntity // IListInfoProvider @Override public void addInfo(List info, boolean isReal, boolean hasData) { - if (isReal) { info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": " + Formatting.GOLD - + PowerSystem.getLocaliszedPowerFormatted(transferRate) + "/t")); + + PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate) + "/t")); info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " - + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString()))); - } + + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))); } // IToolDrop diff --git a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java index d28ab81d2..b5e53fd3b 100644 --- a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java @@ -156,7 +156,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.day") + ": " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD))); - info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.day") + ": " + info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.night") + ": " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN))); info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.tier") + ": " diff --git a/src/main/java/techreborn/blocks/cable/BlockCable.java b/src/main/java/techreborn/blocks/cable/CableBlock.java similarity index 98% rename from src/main/java/techreborn/blocks/cable/BlockCable.java rename to src/main/java/techreborn/blocks/cable/CableBlock.java index 93b086287..c7fe6bb04 100644 --- a/src/main/java/techreborn/blocks/cable/BlockCable.java +++ b/src/main/java/techreborn/blocks/cable/CableBlock.java @@ -60,7 +60,7 @@ import javax.annotation.Nullable; /** * Created by modmuss50 on 19/05/2017. */ -public class BlockCable extends BlockWithEntity { +public class CableBlock extends BlockWithEntity { public static final BooleanProperty EAST = BooleanProperty.of("east"); public static final BooleanProperty WEST = BooleanProperty.of("west"); @@ -71,7 +71,7 @@ public class BlockCable extends BlockWithEntity { public final TRContent.Cables type; - public BlockCable(TRContent.Cables type) { + public CableBlock(TRContent.Cables type) { super(Block.Settings.of(Material.STONE).strength(1f, 8f)); this.type = type; setDefaultState(this.stateFactory.getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false) @@ -127,7 +127,7 @@ public class BlockCable extends BlockWithEntity { @Nullable @Override public BlockEntity createBlockEntity(BlockView worldIn) { - return new CableBlockEntity(); + return new CableBlockEntity(type); } // Block diff --git a/src/main/java/techreborn/init/TRContent.java b/src/main/java/techreborn/init/TRContent.java index c7b386cb2..3cea2a8ce 100644 --- a/src/main/java/techreborn/init/TRContent.java +++ b/src/main/java/techreborn/init/TRContent.java @@ -50,7 +50,7 @@ import techreborn.blockentity.machine.tier1.*; import techreborn.blockentity.machine.tier3.*; import techreborn.blockentity.storage.AdjustableSUBlockEntity; import techreborn.blocks.*; -import techreborn.blocks.cable.BlockCable; +import techreborn.blocks.cable.CableBlock; import techreborn.blocks.generator.*; import techreborn.blocks.lighting.BlockLamp; import techreborn.blocks.storage.*; @@ -258,7 +258,7 @@ public class TRContent { public final String name; - public final BlockCable block; + public final CableBlock block; public int transferRate; public int defaultTransferRate; @@ -276,7 +276,7 @@ public class TRContent { this.canKill = canKill; this.defaultCanKill = canKill; this.tier = tier; - this.block = new BlockCable(this); + this.block = new CableBlock(this); InitUtils.setup(block, name + "_cable"); }