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 guys, I'm having some trouble to update my mob hit box. I created a custom growth system (which is working fine),  so I can't use the vanilla class.

 

I tried using the setSize() method, but it doesn't seem to work:

 

        public void setCreatureSize(float xzSize, float ySize) {

System.out.println("xzSize: " + xzSize + " ySize: " + ySize);

super.setSize(xzSize, ySize);

}

 

How can I change/update the hitbox of a mob?

 

Why do you think it doesn't work?  the setSize() method (assuming your class is an extension of something in the Entity class hierarchy is the right method -- you can check the source and it changes the boundingBox.

 

By the way, if you press F3+B while playing the game, it will make all the entity hitboxes visible.  I recommend this whenever people are making custom models or otherwise mucking around with hitboxes so you can see what is really going on.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

I don't know why, but the boundingBox doesn't change... Do I need something like a datawatcher for this?

Did you make sure that your call to setSize runs after the vanilla call to set size? IIRC, setSize has some side effects, so you might just want to override it anyway.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

  • Author

I found my mistake! I was using the client side of the onUpdate() method to run the super.setSize(). I should have called it on the server side of the living update, just like vanilla! :)

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.