Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello

 

I have an entity, that changes it´s model to an inflated variant, if i collide with it in the game.

 

How do i make ir change it´s collision-box- / boundingbox-size, too?

  • Author

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?

  • Author

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.