Jump to content

Change Entity.boundingBox to use getter/setter


Recommended Posts

I'm sorry if this isn't possible for whatever reason I just don't realize, but it bugs me that boundingBox is currently a 'final' field, and I think it would be much better and more flexible if it was changed to use getter/setter methods.


What made me think of this is that I recently had a cool (in my opinion at least :P) idea, involving a custom collider class extending AxisAlignedBB, which would allow a much more complex hitbox for my large, animated entity.


What do you guys think?

Link to comment
Share on other sites

Hmm. I was afraid it would turn out to be more complex than I thought. To me it seems like you could just do a simple find&replace from 'boundingBox' to 'getBoundingBox()'. Since the field is final it can never be assigned anywhere, so you wouldn't even need to check for that.


Guess there's more to it, huh?

Link to comment
Share on other sites

Haha! I guess I am a bit lazy, although the specific thing I had in mind cannot really be done with multiple entities, and it would actually allow for more complex colliders than AABB's, which I think would be beneficial for everyone. Also I was thinking this could be done in the process of upgrading to 1.8, at which point everyone will need to update anyway.


But yea, it might be a bit much of a hassle.

Link to comment
Share on other sites

What do you mean? I can make Entity.boundingBox not be final, without base edits? Or are you saying I could do what I'm asking even when it is final? I don't think so.


I'll try to clarify. What I'm trying to do is to write a custom collider class that extends AxisAlignedBB and overrides some of its methods, and assign it as the boundingBox of my entity. This way I could for example use boolean operations with intersecting bounding boxes, to create complex collider shapes.


How would I do this without editing base classes, when boundingBox is final?

Link to comment
Share on other sites

I can make Entity.boundingBox not be final, without base edits?

Or are you saying I could do what I'm asking even when it is final?


Nothing you are wanting to do requires base edits.

Please do some research and try to solve your own problems. Its actually rather simple and is done quite often in Minecraft. There is a plethora of ways to deal with it.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

I'm very curious about how you suppose I would make it non-final, when it is not possible to override member fields in an extending class.


And when you say it can be done anyway, I must say I think you don't understand what I'm saying. Maybe I'm not explaining well enough. I am not trying to add different boxes together to form a multi-part shape. I want to "subtract" parts of the bounding box, making a raytrace pass through it.


I have certainly made a fair bit of research already, but if you know of something that I've missed, please point me in the right direction.

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.

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.


  • Create New...

Important Information

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