Vertical threshold switch redstone fix

- Fix vertical threshold switches outputting redstone signal from wrong
sides
This commit is contained in:
PepperCode1 2023-10-28 19:44:24 -07:00
parent 8bf42ffa6f
commit 2cf7d171df

View file

@ -56,7 +56,7 @@ public class ThresholdSwitchBlock extends DirectedDirectionalBlock implements IB
@Override @Override
public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, Direction side) { public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, Direction side) {
return side != null && side.getOpposite() != state.getValue(FACING); return side != null && side.getOpposite() != getTargetDirection(state);
} }
@Override @Override
@ -66,7 +66,7 @@ public class ThresholdSwitchBlock extends DirectedDirectionalBlock implements IB
@Override @Override
public int getSignal(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) { public int getSignal(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) {
if (side == blockState.getValue(FACING) if (side == getTargetDirection(blockState)
.getOpposite()) .getOpposite())
return 0; return 0;
return getBlockEntityOptional(blockAccess, pos).filter(ThresholdSwitchBlockEntity::isPowered) return getBlockEntityOptional(blockAccess, pos).filter(ThresholdSwitchBlockEntity::isPowered)