Jump to content

changing vanilla mob's hitbox size


yarrmateys

Recommended Posts

is it possible to do that without a coremod?

 

i currently use a way where it registers a nearly empty entity (other than the changed hitbox) that extends into the original one, which then replaces the original entity and deletes it, which works, but is incompatible with other mods that refer to that mob (because when entitycreeper becomes something like modid.entitycreeperX they can no longer affect it since it doesn't match what they look for).

 

so i'd be interested to know if there's a way to change the hitbox without actually replacing the entity with a modded one or using any coremods.

 

another thing i'd be interested in is if there's a way to suppress particles, such as blaze's smoke without modifying their base code, or doing the thing above.

Link to comment
Share on other sites

The bounding box is set by the setSize() method but that is protected so not accessible from different package. 

 

However, the setSize() just updates the boundingBox (which has maxX, maxY, etc. fields).  The bounding box is public, so theoretically you can access it directly, but it is also final so I'm not sure if it is editable after it is is initialized (my Java knowledge on this is a bit sketchy).  I've heard that you can only change a final field in the constructor, but the Entity class sets it to all 0s in the constructor so I don't really understand how classes that extend it can change it later, but I guess they also do it in the constructor.  Anyway, you should see if you can change the boundingBox directly, but I suspect you can't unless you're doing it in the constructor of a class that extends Entity.

 

So I think the answer is to use Java reflection.  I think it should work because it is a non-static field, and I believe final fields are editable with reflection if they are non-static.  So try that.  Reflection isn't really that hard to do.

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

Link to comment
Share on other sites

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.