Jump to content

[1.15.2] How do i make an entity change it´s collision-box-size


Drachenbauer

Recommended Posts

In this method now i have an if else, that uses my already existing boolean to provide two size values.

But it doesn´t change the size of the box, that i can see, if i press F3 and B.

 

I have the structure, that changes the model:

    @Override
    public void livingTick()
    {
        if (timeUntilDeflating > 0)
        {
            timeUntilDeflating--;
            
            if (timeUntilDeflating == 0)
            {
                isInflated = false;
                
            }
        }
        else
        {
            super.livingTick();
        }
    }
    
    @Override
    public void onCollideWithPlayer(PlayerEntity entityIn)
    {
        if (timeUntilDeflating == 0)
        {
            timeUntilDeflating = 80;
            isInflated = true;
            
        }
    }

How do i now call it in there?

Link to comment
Share on other sites

Bump:

 

Now i found out, that i have to use

recalculateSize();

there.

 

But the bigger box doesn´t fit to his position...

And if he is in water, he disappears after inflating (i was glitched into him, maybe that´s a reason, too)

 

how do i fix this?

 

Edit:

now i use this to change his boundingbox:

                AxisAlignedBB aabb = this.getBoundingBox();
                this.setBoundingBox(new AxisAlignedBB(aabb.minX + 0.5d, aabb.minY, aabb.minZ + 0.5d, aabb.maxX - 0.5d, aabb.maxY - 1.0d, aabb.maxZ - 0.5d));

I use it in "livengTick" and "onCollidewithPlayer"

Now the key F3 + B shows his boundingbox matching his bodysize, but i can run through him...

How do i make this boundingbox act as collisionbox and hitbox, too?

Edited by Drachenbauer
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.