feat(informer): add info about nearest entities

This commit is contained in:
jay 2021-01-16 16:17:42 +05:00
parent 3488a94233
commit 9a6e684b11

View File

@ -21,6 +21,16 @@ function item(
cfg.quiet || bot.chat(info.join(": "))
}
function entity(name) {
const entity = bot.nearestEntity((entity) => {
return name && entity.name ? entity.name == name : true
})
console.log(entity)
let info = [entity.type, entity.name]
if (entity.metadata) info.push("len: " + entity.metadata.length)
cfg.quiet || bot.chat(info.join("; "))
}
function command(message_parts) {
switch (message_parts.length) {
case 0:
@ -29,6 +39,9 @@ function command(message_parts) {
case "item":
item()
break
case "entity":
entity()
break
case "block":
default:
block()
@ -53,4 +66,4 @@ const load = (config) => {
const unload = () => {}
module.exports = { load, unload, command, block, item }
module.exports = { load, unload, command, block, item, entity }