Jump to content

Recommended Posts

Posted (edited)

I'm currently implementing an Oil Pump block. It's bigger than a regular block and is loaded with the wavefront (.obj) loader provied by Forge.

I'm trying to add collision boxes to my block but some of my collision boxes are bigger than 16x16x16, and i can walk through them...

Here's what I override to create my bounding boxes :

@Override
    public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
        return switch (state.getValue(FACING)) {
            default -> Shapes.or(box(-5, 2, 17, 37, 53, 32), box(-5, 2, -13, 37, 53, 2), box(-12, 0, -20, 44, 4, 53), box(6, 1, 43, 26, 26, 62), box(9, 49, 2, 23, 53, 17));
            case NORTH -> Shapes.or(box(-21, 2, -16, 21, 53, -1), box(-21, 2, 14, 21, 53, 29), box(-28, 0, -37, 28, 4, 36), box(-10, 1, -46, 10, 26, -27), box(-7, 49, -1, 7, 53, 14));
            case EAST -> Shapes.or(box(17, 2, -21, 32, 53, 21), box(-13, 2, -21, 2, 53, 21), box(-20, 0, -28, 53, 4, 28), box(43, 1, -10, 62, 26, 10), box(2, 49, -7, 17, 53, 7));
            case WEST -> Shapes.or(box(-16, 2, -5, -1, 53, 37), box(14, 2, -5, 29, 53, 37), box(-37, 0, -12, 36, 4, 44), box(-46, 1, 6, -27, 26, 26), box(-1, 49, 9, 14, 53, 23));
        };
    }

My question is : Is there a way to bypass the collision box size limit on blocks ?

Edited by Windokk
  • Windokk changed the title to [1.20.1] Need help with big block's collision box
Posted
1 hour ago, Windokk said:

My question is : Is there a way to bypass the collision box size limit on blocks ?

A block should never be bigger than the standard 16x16x16 size. If you need something bigger than that you should split it into several different blocks (like how tall grass does it).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.