Jump to content

Recommended Posts

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?

 

Posted

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/

Posted

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.

Posted

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

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