Jump to content

[1.16.5] Detect block below entity


samjviana

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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



×
×
  • Create New...

Important Information

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