Rotation with Bounding Box broken

Published by hawkster97 on Tue, 02/05/2019 - 05:28
Upvotes: 0
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

I can confirm this issue, we will try to fix it in next update.

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;
		}
	}

 

This bug will be fixed in 1.8.3. I am closing this ticket now.