Jump to content

Recommended Posts

Posted

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.

Posted

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 

  • Thanks 1
Posted

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.

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.

Announcements



×
×
  • Create New...

Important Information

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