Posted November 9, 20214 yr Is there a way to detect which block is below and given entity, in a way that it work for full blocks, slabs, and fences/walls. Actually i can detect the block below the entity using world.getBlockState(entity.getPosition().down()), but then it won't work for half slabs, and if i write an "verification" if the Y pos is .5 (half slab) then it won't detect if it is above an wall.
November 9, 20214 yr you need to check if the Entity's y coordinate is in the middle of a Block like: 0.75>y>0.25 and if it is you should use the relative coordinates of the Entity yo get the Block
November 9, 20214 yr Author Thanks... I was implementing your idea, then i realized that if i check the block using the height 0 (kinda like "the block that the entity is in") it will always detect air when the player is standing in any full block (OF COURSE), including an full block of slabs but when the entity is standing in an half slab block, the block detected will be the slab, the entity is above the half salb, but is inside the block containing the slab, pretty confuse hahaha. With that in mind i verify if the block that the player is inserted in, is an slab, and if it's not than i verify the block below with world.getBlockState(entity.getPosition().down()), worked like a charm.
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.