feat(informer): add info for block at given position

This commit is contained in:
jay 2021-01-17 13:02:05 +05:00
parent 2601b7cfb1
commit 8a39596b1d

View File

@ -1,9 +1,10 @@
let cfg let cfg
let bot let bot
let mcData let mcData
const v = require('vec3')
function block() { function block(pos) {
const block = bot.blockAtCursor() const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor()
console.log(block) console.log(block)
if (!block) { if (!block) {
cfg.quiet || bot.chat("empty") cfg.quiet || bot.chat("empty")
@ -38,6 +39,9 @@ function entity(name) {
function command(message_parts) { function command(message_parts) {
switch (message_parts.length) { switch (message_parts.length) {
case 0: case 0:
// TODO most recent command?
block()
break;
case 1: case 1:
switch (message_parts[0]) { switch (message_parts[0]) {
case "item": case "item":
@ -54,6 +58,16 @@ function command(message_parts) {
break; break;
case 4:
switch (message_parts[0]) {
case "block":
default:
block(message_parts.slice(1))
break;
}
break;
default: default:
break; break;
} }