Skip to content

Commit

Permalink
Fixed block rotation (collision_detector) in blockstates
Browse files Browse the repository at this point in the history
Luna committed Sep 2, 2024
1 parent 4bc1bf2 commit 9d2ca50
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -29,12 +29,12 @@
public class CollisionDetector extends Block implements EntityBlock {
public CollisionDetector(Properties properties) {
super(properties);
registerDefaultState(defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
registerDefaultState(defaultBlockState().setValue(BlockStateProperties.FACING, Direction.SOUTH));
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
return Objects.requireNonNull(super.getStateForPlacement(ctx))
.setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite());
.setValue(BlockStateProperties.FACING, ctx.getNearestLookingDirection().getOpposite());
}

@Override
@@ -63,7 +63,7 @@ public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Directio
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(BlockStateProperties.HORIZONTAL_FACING);
builder.add(BlockStateProperties.FACING);
}

@Override
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public static <T extends BlockEntity> void tick(Level __level, BlockPos __blockP
}

boolean blockDetected = false;
Direction direction = __blockState.getValue(BlockStateProperties.HORIZONTAL_FACING);
Direction direction = __blockState.getValue(BlockStateProperties.FACING);

Pair<BlockPos, BlockPos> minMax = getDetectionMinMax(__blockPos, direction, collisionBlock.range, collisionBlock.width);

Original file line number Diff line number Diff line change
@@ -11,10 +11,10 @@
},
"facing=north": {"model": "jetoverlay:block/collision_detector"},
"facing=up": {"model": "jetoverlay:block/collision_detector",
"x": 90
"x": 270
},
"facing=down": {"model": "jetoverlay:block/collision_detector",
"x": 180
"x": 90
}
}
}

0 comments on commit 9d2ca50

Please sign in to comment.