fix(informer): 🥅 catch and report when objects are missing
This commit is contained in:
parent
4e7f8d59fd
commit
63849e0729
|
@ -7,7 +7,7 @@ function block(pos) {
|
|||
const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor()
|
||||
console.log(block, block && block.getProperties())
|
||||
if (!block) {
|
||||
cfg.quiet || bot.chat("empty")
|
||||
cfg.quiet || bot.chat("empty block")
|
||||
return block
|
||||
}
|
||||
let info = [block.type, block.name]
|
||||
|
@ -21,6 +21,10 @@ function item(
|
|||
) {
|
||||
const item = bot.inventory.slots[loc + bot.QUICK_BAR_START]
|
||||
console.log(item)
|
||||
if (!item) {
|
||||
cfg.quiet || bot.chat("no item")
|
||||
return item
|
||||
}
|
||||
let info = [item.type, item.name]
|
||||
if (item.metadata) info.push(item.metadata)
|
||||
cfg.quiet || bot.chat(info.join(": "))
|
||||
|
@ -31,6 +35,10 @@ function entity(name) {
|
|||
return name && entity.name ? entity.name == name : true
|
||||
})
|
||||
console.log(entity)
|
||||
if (!entity) {
|
||||
cfg.quiet || bot.chat("no entity")
|
||||
return entity
|
||||
}
|
||||
let info = [entity.type, entity.name]
|
||||
if (entity.metadata) info.push("len: " + entity.metadata.length)
|
||||
cfg.quiet || bot.chat(info.join("; "))
|
||||
|
|
Loading…
Reference in New Issue
Block a user