PrismarineJS / prismarine-entity

Represent a minecraft entity
22 stars 15 forks source link

Check if entity is visible #14

Open SinanAkkoyun opened 3 years ago

SinanAkkoyun commented 3 years ago

I have to check if a given entity is visible.

My bot chases the invisible anti cheat fake players flying around him all the time.

I would love to see something like an entity.visible

Thank you!

u9g commented 3 years ago

could you just check the targetted player’s entity for status effects?

SinanAkkoyun commented 3 years ago

No, these fake players don't have an invisible potion on them... They do have their invisible flag turned on. Thats another attribute

SinanAkkoyun commented 3 years ago

Or can somebody help me understand how to parse the metadata? I think thats it

SinanAkkoyun commented 3 years ago

Yesss, I did it, do a bitmask of x20 on the first entry of metadata

Please add this as a simple entity.invisible, entity.onfire etc

SinanAkkoyun commented 3 years ago

console.log(player.entity.metadata[0] & 32 ? "yes" : "no")

rom1504 commented 3 years ago

Feel free to open a pull request for this