Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ffd5119

Browse files
committed
made cables colorable
1 parent 4292f3c commit ffd5119

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

common/src/main/java/muramasa/antimatter/pipe/BlockCable.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import muramasa.antimatter.Ref;
44
import muramasa.antimatter.blockentity.pipe.BlockEntityCable;
5+
import muramasa.antimatter.blockentity.pipe.BlockEntityPipe;
56
import muramasa.antimatter.data.AntimatterDefaultTools;
67
import muramasa.antimatter.pipe.types.Cable;
78
import muramasa.antimatter.texture.Texture;
@@ -68,11 +69,17 @@ public boolean isFireSource(BlockState state, LevelReader world, BlockPos pos, D
6869
@Override
6970
public int getBlockColor(BlockState state, @Nullable BlockGetter world, @Nullable BlockPos pos, int i) {
7071
if (!(state.getBlock() instanceof BlockCable) && world == null || pos == null) return -1;
71-
return insulated ? i == 1 ? getRGB() : -1 : i == 0 || i == 1 ? getRGB() : -1;
72+
BlockEntityPipe<?> pipe = getTilePipe(world, pos);
73+
if (insulated && pipe != null && pipe.getPipeColor() != -1 && i == 0) return pipe.getPipeColor();
74+
if (insulated) return i == 1 ? getRGB() : -1;
75+
return i == 0 || i == 1 ? getRGB() : -1;
7276
}
7377

7478
@Override
7579
public int getItemColor(ItemStack stack, @Nullable Block block, int i) {
80+
if (insulated && stack.getTag() != null && stack.getTag().contains(Ref.KEY_PIPE_TILE_COLOR) && i == 0){
81+
return stack.getTag().getInt(Ref.KEY_PIPE_TILE_COLOR);
82+
}
7683
return insulated ? i == 1 ? getRGB() : -1 : getRGB();
7784
}
7885

0 commit comments

Comments
 (0)