diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 9b35546bbe6..e3e4e6a5ab7 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -83,6 +83,7 @@ public BlockPipe() { protected abstract NodeDataType getFallbackType(); + // TODO this has no reason to need an ItemStack parameter public abstract PipeType getItemPipeType(ItemStack itemStack); public abstract void setTileEntityData(TileEntityPipeBase pipeTile, ItemStack itemStack); diff --git a/src/main/java/gregtech/api/unification/material/Material.java b/src/main/java/gregtech/api/unification/material/Material.java index 9faf83ab07a..f3cfa882e57 100644 --- a/src/main/java/gregtech/api/unification/material/Material.java +++ b/src/main/java/gregtech/api/unification/material/Material.java @@ -743,6 +743,11 @@ public Builder cableProperties(long voltage, int amperage, int loss) { return this; } + public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon) { + properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss, isSuperCon)); + return this; + } + public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof) { properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof)); return this; diff --git a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java index 557b0f59823..f94a2fc6ec5 100644 --- a/src/main/java/gregtech/api/unification/material/properties/WireProperties.java +++ b/src/main/java/gregtech/api/unification/material/properties/WireProperties.java @@ -7,19 +7,24 @@ public class WireProperties implements IMaterialProperty { public final int voltage; public final int amperage; public final int lossPerBlock; - public final boolean isSuperconductor = false; // todo implement + public final boolean isSuperconductor; public WireProperties(int voltage, int baseAmperage, int lossPerBlock) { + this(voltage, baseAmperage, lossPerBlock, false); + } + + public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon) { this.voltage = voltage; this.amperage = baseAmperage; - this.lossPerBlock = lossPerBlock; + this.lossPerBlock = isSuperCon ? 0 : lossPerBlock; + this.isSuperconductor = isSuperCon; } /** * Default values constructor */ public WireProperties() { - this(8, 1, 1); + this(8, 1, 1, false); } @Override @@ -34,7 +39,8 @@ public boolean equals(Object o) { WireProperties that = (WireProperties) o; return voltage == that.voltage && amperage == that.amperage && - lossPerBlock == that.lossPerBlock; + lossPerBlock == that.lossPerBlock && + isSuperconductor == that.isSuperconductor; } @Override diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index 8ddc3721e1e..693f28f5210 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -201,8 +201,10 @@ public static void init() { } if (material.hasProperty(PropertyKey.WIRE)) { - for (BlockCable cable : CABLES) - cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE)); + for (BlockCable cable : CABLES) { + if (!cable.getItemPipeType(null).isCable() || !material.getProperty(PropertyKey.WIRE).isSuperconductor) + cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE)); + } } if (material.hasProperty(PropertyKey.FLUID_PIPE)) { for (BlockFluidPipe pipe : FLUID_PIPES) diff --git a/src/main/java/gregtech/common/pipelike/cable/Insulation.java b/src/main/java/gregtech/common/pipelike/cable/Insulation.java index 5e57db09663..cf4a12ec2a5 100644 --- a/src/main/java/gregtech/common/pipelike/cable/Insulation.java +++ b/src/main/java/gregtech/common/pipelike/cable/Insulation.java @@ -53,6 +53,9 @@ public OrePrefix getOrePrefix() { return orePrefix; } + public boolean isCable() { + return ordinal() > 4; + } @Override public WireProperties modifyProperties(WireProperties baseProperties) { @@ -62,7 +65,7 @@ public WireProperties modifyProperties(WireProperties baseProperties) { lossPerBlock = (int) (0.75 * lossMultiplier); else lossPerBlock = baseProperties.lossPerBlock * lossMultiplier; - return new WireProperties(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock); + return new WireProperties(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock, baseProperties.isSuperconductor); } @Override diff --git a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java index 886b2da8a54..41d77f8dc8d 100644 --- a/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java +++ b/src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java @@ -23,9 +23,10 @@ public ItemBlockCable(BlockCable block) { @Override @SideOnly(Side.CLIENT) - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, List tooltip, @Nonnull ITooltipFlag flagIn) { + public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { WireProperties wireProperties = blockPipe.createItemProperties(stack); String voltageName = GTValues.VN[GTUtility.getTierByVoltage(wireProperties.voltage)]; + if (wireProperties.isSuperconductor) tooltip.add(I18n.format("gregtech.cable.superconductor", voltageName)); tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.voltage, voltageName)); tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.amperage)); tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock)); diff --git a/src/main/java/gregtech/loaders/oreprocessing/WireRecipeHandler.java b/src/main/java/gregtech/loaders/oreprocessing/WireRecipeHandler.java index 281c7933bbe..3576a86003e 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/WireRecipeHandler.java +++ b/src/main/java/gregtech/loaders/oreprocessing/WireRecipeHandler.java @@ -79,6 +79,7 @@ public static void processWireSingle(OrePrefix wirePrefix, Material material, Wi } public static void generateWireRecipe(OrePrefix wirePrefix, Material material, WireProperties property) { + if (property.isSuperconductor) return; int cableAmount = (int) (wirePrefix.materialAmount * 2 / M); OrePrefix cablePrefix = OrePrefix.getPrefix("cable" + wirePrefix.name().substring(4)); ItemStack cableStack = OreDictUnifier.get(cablePrefix, material); @@ -154,6 +155,7 @@ public static void generateWireCombiningRecipe(OrePrefix wirePrefix, Material ma } public static void generateCableCombiningRecipe(OrePrefix cablePrefix, Material material, WireProperties property) { + if (property.isSuperconductor) return; int cableIndex = ArrayUtils.indexOf(CABLE_DOUBLING_ORDER, cablePrefix); if (cableIndex < CABLE_DOUBLING_ORDER.length - 1) { diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index fc73e7c8c3d..4b761143dc7 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -3622,6 +3622,7 @@ gregtech.item_filter.footer=§eClick with item to override gregtech.cable.voltage=Max Voltage: §a%,d §a(%s) gregtech.cable.amperage=Max Amperage: §e%,d gregtech.cable.loss_per_block=Loss/Meter/Ampere: §c%,d§7 EU-Volt +gregtech.cable.superconductor=§d%s Superconductor gregtech.fluid_pipe.throughput=§9Transfer Rate: %,d L/s gregtech.fluid_pipe.max_temperature=§cTemperature Limit: %,dK