feat(informer): ✨ add info about nearest entities
This commit is contained in:
parent
3488a94233
commit
9a6e684b11
|
@ -21,6 +21,16 @@ function item(
|
||||||
cfg.quiet || bot.chat(info.join(": "))
|
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) {
|
function command(message_parts) {
|
||||||
switch (message_parts.length) {
|
switch (message_parts.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -29,6 +39,9 @@ function command(message_parts) {
|
||||||
case "item":
|
case "item":
|
||||||
item()
|
item()
|
||||||
break
|
break
|
||||||
|
case "entity":
|
||||||
|
entity()
|
||||||
|
break
|
||||||
case "block":
|
case "block":
|
||||||
default:
|
default:
|
||||||
block()
|
block()
|
||||||
|
@ -53,4 +66,4 @@ const load = (config) => {
|
||||||
|
|
||||||
const unload = () => {}
|
const unload = () => {}
|
||||||
|
|
||||||
module.exports = { load, unload, command, block, item }
|
module.exports = { load, unload, command, block, item, entity }
|
Loading…
Reference in New Issue
Block a user