feat(informer): ✨ add villager profession details
Provide names in place of numbers for villager profession. Implementation uses an enum
This commit is contained in:
parent
8276e68489
commit
feb0b0927a
|
@ -116,6 +116,25 @@ function item(
|
|||
return item
|
||||
}
|
||||
|
||||
var VillagerProfession
|
||||
(function (VillagerProfession) {
|
||||
VillagerProfession[VillagerProfession["Unemployed"] = 0] = "Unemployed"
|
||||
VillagerProfession[VillagerProfession["Armourer"] = 1] = "Armourer"
|
||||
VillagerProfession[VillagerProfession["Butcher"] = 2] = "Butcher"
|
||||
VillagerProfession[VillagerProfession["Cartographer"] = 3] = "Cartographer"
|
||||
VillagerProfession[VillagerProfession["Cleric"] = 4] = "Cleric"
|
||||
VillagerProfession[VillagerProfession["Farmer"] = 5] = "Farmer"
|
||||
VillagerProfession[VillagerProfession["Fisherman"] = 6] = "Fisherman"
|
||||
VillagerProfession[VillagerProfession["Fletcher"] = 7] = "Fletcher"
|
||||
VillagerProfession[VillagerProfession["Leatherworker"] = 8] = "Leatherworker"
|
||||
VillagerProfession[VillagerProfession["Librarian"] = 9] = "Librarian"
|
||||
VillagerProfession[VillagerProfession["Mason"] = 10] = "Mason"
|
||||
VillagerProfession[VillagerProfession["Nitwit"] = 11] = "Nitwit"
|
||||
VillagerProfession[VillagerProfession["Shepherd"] = 12] = "Shepherd"
|
||||
VillagerProfession[VillagerProfession["Toolsmith"] = 13] = "Toolsmith"
|
||||
VillagerProfession[VillagerProfession["Weaponsmith"] = 14] = "Weaponsmith"
|
||||
})(VillagerProfession || (VillagerProfession = {}))
|
||||
|
||||
function entity(name = bot.nearestEntity()) {
|
||||
const entity = typeof name === "string" ? (name = name.toLowerCase()) && bot.nearestEntity((entity) => {
|
||||
const enames = [entity.username?.toLowerCase(), entity.name, entity.displayName?.toLowerCase()]
|
||||
|
@ -152,7 +171,9 @@ function entity(name = bot.nearestEntity()) {
|
|||
case "mob":
|
||||
switch (name) {
|
||||
case 'villager':
|
||||
info.push(Object.entries(entity.metadata[17]).toString())
|
||||
const { villagerProfession, ...otherProps } = entity.metadata[17]
|
||||
info.push(VillagerProfession[villagerProfession])
|
||||
info.push(Object.entries(otherProps).toString())
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user