PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
5.02k stars 910 forks source link

`entity.kind` is `UNKNOWN` on 1.18.2 server #2531

Open wvffle opened 2 years ago

wvffle commented 2 years ago

Versions

Detailed description of a problem

When trying to check for the hostile mobs, I realized that the kind is in most cases (if not in all) UNKNOWN

Expected behavior

entity.kind should represent its kind

Additional context

image

rom1504 commented 2 years ago

We would need to find a source for this information It used to come from wikis I don't know if burger has it

sefirosweb commented 2 years ago

hi @rom1504 in entities.json appears correctly the hostile mob: https://github.com/PrismarineJS/minecraft-data/blob/d9f34c105be018d757491fab6a9ba5c5c652481b/data/pc/1.18/entities.json#L389

But the part of code for get this info seems is not modified from a 5 years ago, but now returns category "unknow" instead type "hostile"

image

I'm trying to find if in other part of code has been changed,

https://github.com/PrismarineJS/mineflayer/blob/9497b67d85082317bf7bf7a19427ed9371cb2f49/lib/plugins/entities.js#L181

We can fix modifiing this line to:

      entity.kind = entity.type === 'mob' ? entityData.type : entityData.category 

But im not sure if that affect other process

image

Bottinator22 commented 2 years ago

1.17 doesn't have the category at all as well this would probably lead to some problems, as type could be "hostile" and category instead be "Hostile mobs"

Furthermore, hoglins are hostile, but the type in that list classifies them as an animal