diff --git a/src/main/java/mods/railcraft/world/level/block/manipulator/ManipulatorBlock.java b/src/main/java/mods/railcraft/world/level/block/manipulator/ManipulatorBlock.java index 7758b1227..a72f06236 100644 --- a/src/main/java/mods/railcraft/world/level/block/manipulator/ManipulatorBlock.java +++ b/src/main/java/mods/railcraft/world/level/block/manipulator/ManipulatorBlock.java @@ -8,14 +8,17 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.BaseRailBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.redstone.Redstone; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.network.NetworkHooks; @@ -56,6 +59,17 @@ public InteractionResult use(BlockState blockState, Level level, public abstract Direction getFacing(BlockState blockState); + @Override + public int getSignal(BlockState blockState, BlockGetter level, BlockPos blockPos, + Direction direction) { + boolean emit = false; + if (isPowered(blockState)) { + var neighborBlockState = level.getBlockState(blockPos.relative(direction.getOpposite())); + emit = BaseRailBlock.isRail(neighborBlockState); + } + return emit ? Redstone.SIGNAL_MAX : Redstone.SIGNAL_NONE; + } + @SuppressWarnings("deprecation") @Override public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState,