Skip to content

Commit b59f0dc

Browse files
committed
finish Supercon value on WireProperty
1 parent 5018bbe commit b59f0dc

File tree

8 files changed

+29
-8
lines changed

8 files changed

+29
-8
lines changed

src/main/java/gregtech/api/pipenet/block/BlockPipe.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public BlockPipe() {
8383

8484
protected abstract NodeDataType getFallbackType();
8585

86+
// TODO this has no reason to need an ItemStack parameter
8687
public abstract PipeType getItemPipeType(ItemStack itemStack);
8788

8889
public abstract void setTileEntityData(TileEntityPipeBase<PipeType, NodeDataType> pipeTile, ItemStack itemStack);

src/main/java/gregtech/api/unification/material/Material.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,11 @@ public Builder cableProperties(long voltage, int amperage, int loss) {
743743
return this;
744744
}
745745

746+
public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon) {
747+
properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss, isSuperCon));
748+
return this;
749+
}
750+
746751
public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof) {
747752
properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof));
748753
return this;

src/main/java/gregtech/api/unification/material/properties/WireProperties.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,24 @@ public class WireProperties implements IMaterialProperty<WireProperties> {
77
public final int voltage;
88
public final int amperage;
99
public final int lossPerBlock;
10-
public final boolean isSuperconductor = false; // todo implement
10+
public final boolean isSuperconductor;
1111

1212
public WireProperties(int voltage, int baseAmperage, int lossPerBlock) {
13+
this(voltage, baseAmperage, lossPerBlock, false);
14+
}
15+
16+
public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon) {
1317
this.voltage = voltage;
1418
this.amperage = baseAmperage;
15-
this.lossPerBlock = lossPerBlock;
19+
this.lossPerBlock = isSuperCon ? 0 : lossPerBlock;
20+
this.isSuperconductor = isSuperCon;
1621
}
1722

1823
/**
1924
* Default values constructor
2025
*/
2126
public WireProperties() {
22-
this(8, 1, 1);
27+
this(8, 1, 1, false);
2328
}
2429

2530
@Override
@@ -34,7 +39,8 @@ public boolean equals(Object o) {
3439
WireProperties that = (WireProperties) o;
3540
return voltage == that.voltage &&
3641
amperage == that.amperage &&
37-
lossPerBlock == that.lossPerBlock;
42+
lossPerBlock == that.lossPerBlock &&
43+
isSuperconductor == that.isSuperconductor;
3844
}
3945

4046
@Override

src/main/java/gregtech/common/blocks/MetaBlocks.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ public static void init() {
201201
}
202202

203203
if (material.hasProperty(PropertyKey.WIRE)) {
204-
for (BlockCable cable : CABLES)
205-
cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE));
204+
for (BlockCable cable : CABLES) {
205+
if (!cable.getItemPipeType(null).isCable() || !material.getProperty(PropertyKey.WIRE).isSuperconductor)
206+
cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE));
207+
}
206208
}
207209
if (material.hasProperty(PropertyKey.FLUID_PIPE)) {
208210
for (BlockFluidPipe pipe : FLUID_PIPES)

src/main/java/gregtech/common/pipelike/cable/Insulation.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public OrePrefix getOrePrefix() {
5353
return orePrefix;
5454
}
5555

56+
public boolean isCable() {
57+
return ordinal() > 4;
58+
}
5659

5760
@Override
5861
public WireProperties modifyProperties(WireProperties baseProperties) {
@@ -62,7 +65,7 @@ public WireProperties modifyProperties(WireProperties baseProperties) {
6265
lossPerBlock = (int) (0.75 * lossMultiplier);
6366
else lossPerBlock = baseProperties.lossPerBlock * lossMultiplier;
6467

65-
return new WireProperties(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock);
68+
return new WireProperties(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock, baseProperties.isSuperconductor);
6669
}
6770

6871
@Override

src/main/java/gregtech/common/pipelike/cable/ItemBlockCable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ public ItemBlockCable(BlockCable block) {
2323

2424
@Override
2525
@SideOnly(Side.CLIENT)
26-
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, List<String> tooltip, @Nonnull ITooltipFlag flagIn) {
26+
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) {
2727
WireProperties wireProperties = blockPipe.createItemProperties(stack);
2828
String voltageName = GTValues.VN[GTUtility.getTierByVoltage(wireProperties.voltage)];
29+
if (wireProperties.isSuperconductor) tooltip.add(I18n.format("gregtech.cable.superconductor", voltageName));
2930
tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.voltage, voltageName));
3031
tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.amperage));
3132
tooltip.add(I18n.format("gregtech.cable.loss_per_block", wireProperties.lossPerBlock));

src/main/java/gregtech/loaders/oreprocessing/WireRecipeHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static void processWireSingle(OrePrefix wirePrefix, Material material, Wi
7979
}
8080

8181
public static void generateWireRecipe(OrePrefix wirePrefix, Material material, WireProperties property) {
82+
if (property.isSuperconductor) return;
8283
int cableAmount = (int) (wirePrefix.materialAmount * 2 / M);
8384
OrePrefix cablePrefix = OrePrefix.getPrefix("cable" + wirePrefix.name().substring(4));
8485
ItemStack cableStack = OreDictUnifier.get(cablePrefix, material);
@@ -154,6 +155,7 @@ public static void generateWireCombiningRecipe(OrePrefix wirePrefix, Material ma
154155
}
155156

156157
public static void generateCableCombiningRecipe(OrePrefix cablePrefix, Material material, WireProperties property) {
158+
if (property.isSuperconductor) return;
157159
int cableIndex = ArrayUtils.indexOf(CABLE_DOUBLING_ORDER, cablePrefix);
158160

159161
if (cableIndex < CABLE_DOUBLING_ORDER.length - 1) {

src/main/resources/assets/gregtech/lang/en_us.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,7 @@ gregtech.item_filter.footer=§eClick with item to override
36223622
gregtech.cable.voltage=Max Voltage: §a%,d §a(%s)
36233623
gregtech.cable.amperage=Max Amperage: §e%,d
36243624
gregtech.cable.loss_per_block=Loss/Meter/Ampere: §c%,d§7 EU-Volt
3625+
gregtech.cable.superconductor=§d%s Superconductor
36253626

36263627
gregtech.fluid_pipe.throughput=§9Transfer Rate: %,d L/s
36273628
gregtech.fluid_pipe.max_temperature=§cTemperature Limit: %,dK

0 commit comments

Comments
 (0)