Multiple Collision Boxes?

Started by Gaansy on Fri, 08/28/2020 - 10:11

Topic category: Help with modding (Java Edition)

Last seen on 00:28, 30. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Multiple Collision Boxes?
Fri, 08/28/2020 - 10:29 (edited)

Hi everyone,

I'm trying to make a block however I require multiple collision/bounding boxes for it to work correctly. How do I add/override an extra box?

        @Override
        public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
            switch ((Direction) state.get(FACING)) {
                case UP :
                case DOWN :
                case SOUTH :
                default :
                    return VoxelShapes.create(1D, 0D, 0.5D, 0D, 1D, 0D);
                case NORTH :
                    return VoxelShapes.create(0D, 0D, 0.5D, 1D, 1D, 1D);
                case WEST :
                    return VoxelShapes.create(0.5D, 0D, 1D, 1D, 1D, 0D);
                case EAST :
                    return VoxelShapes.create(0.5D, 0D, 0D, 0D, 1D, 1D);
            }
        }
 

This is basically a vertical slab, how do I add an extra cube beside it?

I am using version 1.14.4, but will be updating to 1.15+

Thanks

Edited by Gaansy on Fri, 08/28/2020 - 10:29
Last seen on 00:28, 30. Oct 2020
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wow, thank you soo much it…
Sat, 08/29/2020 - 03:37

Wow, thank you soo much it worked!

After editing values and for the collision box I managed to get it working the way I wanted it.

Really appreciate the help, I can finally finish my mod :)

TYSM!