Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
}

public static final class BlockPlacerPlacementContext extends AutomaticItemPlacementContext {
// Shadows the variable facing in the superclass.
private final Direction facing;

public BlockPlacerPlacementContext(World world, BlockPos pos, Direction facing, ItemStack stack, Direction side) {
super(world, pos, facing, stack, side);
this.facing = facing;
}

public Direction getPlayerLookDirection() {
return facing.getOpposite();
}

// SlabBlocks cause a non-funny StackOverflowError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
public BlockState getPlacementState(ItemPlacementContext ctx) {
Direction direction = ctx.getPlayerLookDirection().getOpposite();
Direction direction2 = switch (direction) {
case DOWN -> ctx.getPlayer().getHorizontalFacing().getOpposite();
case UP -> ctx.getPlayer().getHorizontalFacing();
case DOWN -> ctx.getHorizontalPlayerFacing().getOpposite();
case UP -> ctx.getHorizontalPlayerFacing();
case NORTH, SOUTH, WEST, EAST -> Direction.UP;
};

Expand Down