Skip to content

Commit

Permalink
Fix redstone emission for detectors (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
robotman2412 committed Feb 24, 2024
1 parent 56483b6 commit 8db6a52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public boolean isSignalSource(BlockState state) {
@Override
public int getSignal(BlockState state, BlockGetter level, BlockPos pos,
Direction direction) {
return state.getValue(POWERED) ? Redstone.SIGNAL_MAX : Redstone.SIGNAL_NONE;
return state.getValue(POWERED) && state.getValue(FACING) == direction.getOpposite()
? Redstone.SIGNAL_MAX : Redstone.SIGNAL_NONE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public static void serverTick(Level level, BlockPos blockPos, BlockState blockSt
blockEntity.powerDelay = CartConstants.DETECTED_POWER_OUTPUT_FADE;
}
level.setBlockAndUpdate(blockPos, blockState.setValue(DetectorBlock.POWERED, powered));
level.updateNeighborsAt(blockPos, blockState.getBlock());
var offsetPos = blockPos.offset(blockState.getValue(DetectorBlock.FACING).getNormal());
level.updateNeighborsAt(offsetPos, blockState.getBlock());
}
blockEntity.tick = 0;
}
Expand Down

0 comments on commit 8db6a52

Please sign in to comment.