Multiple Collision Boxes?

Started by Gaansy on

Topic category: Help with modding (Java Edition)

Last seen on 05:45, 24. Jun 2021
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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 05:45, 24. Jun 2021
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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!