Custom Mob Hitbox

Started by Kane on Mon, 08/07/2017 - 17:59

Topic category: Advanced modding

Last seen on 12:58, 23. Sep 2019
Joined Aug 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Custom Mob Hitbox
Mon, 08/07/2017 - 17:59

Hi guys.

I need a little help.

I'd like to change the hitbox of my mob.

I know the setSize method, but I need something to change the "shape" of the hitbox.

What I mean is: I have a dog-like mob and using the setSize method I can only "give" it a cube-like hit box since withat this method, I can only change width and height (so x+z together and y alone). Considering that it's more lenghty than tall, I was wondering if there's a way to make it a "proper" hitbox (I really hate when I can kill it swinging near to it or cannot kill it in the same way).

 

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Entity#setEntityBoundingBox()
Mon, 08/07/2017 - 18:48

Entity#setEntityBoundingBox()

Last seen on 12:58, 23. Sep 2019
Joined Aug 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
RE:Entity#setEntityBoundingBox()
Mon, 08/07/2017 - 23:00

@#1 And here you are again like 1 (or 2?) years ago Nuparu ahah
How you doing?
Btw, by "Entity#" I have to use my entity "name" right?
And in () it's x, y and z? 

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I think it's one year, it was
Tue, 08/08/2017 - 00:00

I think it's one year, it was summer too, right? :D
I am finally finishing my mod. Yes, the exact same mod that I was working one year ago. I plan to finish it in a couple of days/weeks and then take some break from programming, though I will be still looking here at the forum.

Anyways
For Entity (# there actually stands for a "dot" , so it can be also Entity.setEntityBoundingBox() ) you can use any reference of entity , so if you are using it outside of the target entity class (that would be especially for editing vanilla/other mod mobs , example : entityPlayer.setEntityBoundingBox(new AxisAlignedBB(0,0,0,1,2,0.5)); ). If you use it inside of the entity class , you can replace by this or you can even remove it at all. (also with the dot).

The method takes a one parameter AxisAlignedBB.It is actually a cuboid. You can create one using new AxisAlignedBB(x1,y1,z1,x2,y2,z2).

So you can use in your entity constructor for example this:
setEntityBoundingBox(new AxisAlignedBB(0,0,0,1,2,0.5));

Also because AABBs that Minecraft uses for all entities bounding boxes are "Axis Aligned", it could mean that for example an axis X of the box is aligned to an axis X of the world, so it won't rotate. However, it could be possible even fix this, with maybe some workaround.

Last seen on 12:58, 23. Sep 2019
Joined Aug 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
RE:I think it's one year, it was
Tue, 08/08/2017 - 09:38

@#2 Yeah, about June x)
Nice to hear that! You didn't ask me for any help since when I told you, you could have finished it before x)
Joking.
I hope it can be a success!

I see, it's a hard world that one of the bounding boxes uh?
I wrote the right line, but it seems the hitbox remain the same as default.
Maybe wrote in the wrong section? I just wrote it like I did for the setSize, under my public Entity**** , using this. before it instead of entitySomething. 

But if you say it cannot obviously rotate unless I find a workaround, I guess I'll stay with that "vanilla cuboid". It goes over my possibilities and time x)