Rotation with Bounding Box broken

Published by hawkster97 on Tue, 02/05/2019 - 05:28
Status
Fixed
Type
Product/platform
Not applicable
Priority
Normal
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;
		}
	}

 



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.