# How does entity's hitbox and block's hitbox interact

## Recommended Posts

I have trouble understanding how the entity's hitbox and block's hitbox interact causing entity's

##### Share on other sites

Well, entities have both planned and unplanned movement. For planned movement, which is usually figured out in the entity AI, it uses a "navigator" to find a path through the blocks. The navigators basically finds a series of positions that the entity can move between where its collision box doesn't collide. Then there is unplanned movement like if you knock it back. I haven't looked at that code specifically, but typically in games it will (a) look for collision before moving the entity into a location (b) reset position to the previous one if it finds itself in a collision. All the collision boxes (block and entity) in Minecraft are rectangular, restricted in size and cannot rotate so it is really simple math to detect a collision.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

##### Share on other sites

2 minutes ago, jabelar said:

I am trying to make a BlockPos custom method for a flying algorithim to my tameable dragon to detect it's altitude. I currently use world#getHeight but that causes issues because gethHeight finds the most uppermost solid block in the world, but the nether has a solid block roof above. I need a custom method which detects a solid block below and to do that I must understand how solid blocks interact with entities

##### Share on other sites

18 hours ago, gummby8 said:

So you want to find how high your entity is from the nearest solid block directly below the entity?

```
BlockPos blockPos = new BlockPos(this.posX, this.posY, this.posZ);
while (!worldObj.getBlockState(blockPos).getBlock().getMaterial().blocksMovement()) {
blockPos = blockPos.down();
}```

That will find the nearest solid block straight down. Then you can calculate the distance

Ok it worked, now I need to detect if it is liquid, lava is Liquid right?

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

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

• ### Posts

• Also remove the mod plane
• There is an issue with Chunk-Loaders-Mod - maybe a conflict with Optifine
• Update your AMD/ATI drivers - get the drivers from their website - do not update via system
• Hiya I'm new to the modding scene and I have created custom 3D armors that work using Geckolib, the only issue is that the set becomes invisible except for the helmet when using Epic Fights custom animations, I have tried going through the tutorial on their website on how to rig it to still work but I have almost no experience in Blender and have gotten quite desperate if someone has experience with this and is willing to help I'd pay a fair price if they are able to set it up properly, I have the block bench models already done it just needs to be properly integrated into epic fight. Thanks!

• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...