Skip to content

Commit

Permalink
Merge pull request #259 from railcraft-reborn/fix-258
Browse files Browse the repository at this point in the history
Fix #258
  • Loading branch information
Edivad99 authored Nov 10, 2024
2 parents e0f3263 + 775dd28 commit 58c8adc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b
BlockPos fromPos, boolean isMoving) {

boolean flag = level.hasNeighborSignal(pos) || level.hasNeighborSignal(pos.above());
level.setBlock(pos, state.setValue(POWERED, flag), 4);
level.setBlock(pos, state.setValue(POWERED, flag), Block.UPDATE_ALL);

if (level.isClientSide()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
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.Blocks;
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;

Expand Down Expand Up @@ -60,19 +56,6 @@ 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)
|| neighborBlockState.is(Blocks.REDSTONE_WIRE)
|| neighborBlockState.is(Blocks.REPEATER);
}
return emit ? Redstone.SIGNAL_MAX : Redstone.SIGNAL_NONE;
}

@SuppressWarnings("deprecation")
@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState,
Expand Down

0 comments on commit 58c8adc

Please sign in to comment.