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

Google revealed to me that a few modders were having issues with setting the bounding box for custom entities.

 

I played around with it for a while and I figured out. This is for those that happen to need and answer and find this thread.

 

 

The bounding box is an AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ) type.

 

The catch is, and where most people seem to be getting confused, is that the these values are not offsets from the center of the entity. These are global world coordinates.

 

So what we would think would be boundingBox(-1, 0, -1, 1, 2, 1), assuming the box is at global coords (350, 75, 670) should really be boundingBox(350 - 1, 75 - 0, 670 - 1, 350 + 1, 75 + 2, 670 + 1).

 

So your final script should look something like this:

 

import net.minecraft.entity.Entity;

 

class myEntity extends EntityLiving {

 

//No local boundingBox variable. The game won't use it.

 

double minX = -1 //this is the left/right direction

double minY = 0 //this is the up/down direction

double minZ = -1 //this is the forward/back direction

double maxX = 1 //this is the left/right direction

double maxY = 2 //this is the up/down direction

double maxZ = 1 //this is the forward/back direction

//this will produce a (2x2x2) bounding box that sits flat on the ground.

 

public myEntity (World par1World, double par2, double par4, double par6) {

 

super(par1World);

 

this.boundingBox.setBounds(par 2 - minX, par4 - minY, par6 - minZ, par2 + maxX, par4 + maxY, par6 + maxZ);

 

}

 

//Not done yet

 

    @Override

    public AxisAlignedBB getCollisionBox(Entity par1Entity)

    {

    return par1Entity.boundingBox;

    }

 

    @Override

    public AxisAlignedBB getBoundingBox()

    {

        return this.boundingBox;

    }

 

    public boolean canBeCollidedWith()

    {

    return !this.isDead;

    }

}

 

//Note this code has NOT been tested nor will I help anyone debug it.

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.