Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey! I can't seem to find any information about this, so I thought I might as well ask here.

 

In previous versions you used to do "setBlockBounds()" but it seems like this method has been removed.

 

I've tried overriding the methods "getCollisionBoundingBox(), getBoundingBox(), getSelectedBoundingBox()" but it doesn't seem to work. If I override "getBoundingBox()" the block looses ALL collision, you can't even remove it, if I change "getSelectedBoundingBox()" nothing special happens, and if I change "getCollisionBoundingBox()" I just change where I can "select" the block with the cursor.  Now, everywhere I read I see people using the "addCollisionBoxToList()" method, but they also use "setBlockBounds()" in conjunction with it, so I'm out of luck.

 

Basically my question is: How do I change a block's collision box in 1.9?

Look at how the cauldron does it.

Essentially, getBoundingBox() refers to what you can get in your outline. Think of stairs. You can point your crosshair above the stair and still get the black outline. The bounding box is FULL_BLOCK_AABB (use that)

To have custom hitboxes (what you collide with), addCollisionBoxToList should be useful. Just override it and put in your custom hitboxes. They use local coordinates, so 0,0,0 is a corner and 1,1,1 is the opposite.

  • Author

I've done this in my addCollisionBoxToList() method:

 

AxisAlignedBB aabb = new AxisAlignedBB(x1, y1, z1, x2, y2, z2);
addCollisionBoxToList(pos, p_185477_4_, p_185477_5_, aabb);
super.addCollisionBoxToList(state, worldIn, pos, p_185477_4_, p_185477_5_, p_185477_6_);

 

But it's not working. It is still one block high. And if I don't call the super method it just has no bounding box at all. I've printed the positions to make sure that they are in the correct positions in the world.

What else am I supposed to do?

Never mind, got it working! I was prematurely adding the position to my aabb's coordinates, which messed up the positioning.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.