Posted October 10, 20178 yr I have trouble understanding how the entity's hitbox and block's hitbox interact causing entity's
October 10, 20178 yr 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. Why are you asking? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
October 10, 20178 yr Author 2 minutes ago, jabelar said: Why are you asking? 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
October 13, 20178 yr Author 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.