Rotation with Bounding Box broken

Published by hawkster97 on
Status
Fixed
Issue description

Hi,

The block rotation implemented in 1.8.2 does not rotate the bounding box. For the default of 0,0,0-1,1,1 it doesn't matter because it's the full block, but when using a custom bounding box with rotation enabled, the bounding box does not rotate.

 

- Alex

Issue comments

What you need to do is overriding Block#getCollisionBoundingBox() and Block#getBoundingBox() so these two methods return the correct AxisAlignedBB based on the state.

@Override
	@Nullable
	public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
		switch ((EnumFacing) blockState.getValue(BlockHorizontal.FACING)) {
		case UP:
		default:
			return AABB_SOUTH;
		case NORTH:
			return AABB_NORTH;
		case SOUTH:
			return AABB_SOUTH;
		case WEST:
			return AABB_WEST;
		case EAST:
			return AABB_EAST;
		}
	}

	@Override
	public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
		switch ((EnumFacing) state.getValue(BlockHorizontal.FACING)) {
		case UP:
		default:
			return AABB_SOUTH;
		case NORTH:
			return AABB_NORTH;
		case SOUTH:
			return AABB_SOUTH;
		case WEST:
			return AABB_WEST;
		case EAST:
			return AABB_EAST;
		}
	}