feat(informer): add more detailed block metadata info

Uses `block.getProperties()`. Thanks to a [comment][1]

[1]: https://github.com/PrismarineJS/mineflayer-pathfinder/pull/84/files#r541196424
This commit is contained in:
jay 2021-01-17 15:54:31 +05:00
parent 7b2b936f81
commit 4e7f8d59fd

View File

@ -5,13 +5,13 @@ const v = require('vec3')
function block(pos) { function block(pos) {
const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor() const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor()
console.log(block) console.log(block, block && block.getProperties())
if (!block) { if (!block) {
cfg.quiet || bot.chat("empty") cfg.quiet || bot.chat("empty")
return block return block
} }
let info = [block.type, block.name] let info = [block.type, block.name]
if (block.metadata) info.push(block.metadata) if (block.metadata) info.push(Object.entries(block.getProperties()))
cfg.quiet || bot.chat(info.join(": ")) cfg.quiet || bot.chat(info.join(": "))
} }