Skip to content

Commit

Permalink
made cables colorable
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Dec 31, 2024
1 parent 4292f3c commit ffd5119
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import muramasa.antimatter.Ref;
import muramasa.antimatter.blockentity.pipe.BlockEntityCable;
import muramasa.antimatter.blockentity.pipe.BlockEntityPipe;
import muramasa.antimatter.data.AntimatterDefaultTools;
import muramasa.antimatter.pipe.types.Cable;
import muramasa.antimatter.texture.Texture;
Expand Down Expand Up @@ -68,11 +69,17 @@ public boolean isFireSource(BlockState state, LevelReader world, BlockPos pos, D
@Override
public int getBlockColor(BlockState state, @Nullable BlockGetter world, @Nullable BlockPos pos, int i) {
if (!(state.getBlock() instanceof BlockCable) && world == null || pos == null) return -1;
return insulated ? i == 1 ? getRGB() : -1 : i == 0 || i == 1 ? getRGB() : -1;
BlockEntityPipe<?> pipe = getTilePipe(world, pos);
if (insulated && pipe != null && pipe.getPipeColor() != -1 && i == 0) return pipe.getPipeColor();
if (insulated) return i == 1 ? getRGB() : -1;
return i == 0 || i == 1 ? getRGB() : -1;
}

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

Expand Down

0 comments on commit ffd5119

Please sign in to comment.