Closed eeoms closed 2 years ago
You need to pass a Block instance to bot.dig, and await it
You can get the Block instance with bot.blockAtCursor
You need to pass a Block instance to bot.dig, and await it
You can get the Block instance with bot.blockAtCursor
setTimeout(async () => {
const block = bot.blockAtCursor
await bot.dig(block, true)
bot.setControlState('left', true)
}, 5000);```
You need to pass a Block instance to bot.dig, and await it
You can get the Block instance with bot.blockAtCursor
setTimeout(async () => { const block = bot.blockAtCursor(8)
await bot.dig(block, false);
bot.setControlState('left', true) }, 5000);
C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19
throw new Error('dig was called with an undefined or null block')
^
Error: dig was called with an undefined or null block
at EventEmitter.dig (C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19:13)
at Timeout._onTimeout (C:\Users\Max\OneDrive\Desktop\MC bot\index.js:23:13)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
You need to pass a Block instance to bot.dig, and await it You can get the Block instance with bot.blockAtCursor
setTimeout(async () => { const block = bot.blockAtCursor(8) await bot.dig(block, false); bot.setControlState('left', true) }, 5000);
C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19 throw new Error('dig was called with an undefined or null block') ^
Error: dig was called with an undefined or null block at EventEmitter.dig (C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19:13) at Timeout._onTimeout (C:\Users\Max\OneDrive\Desktop\MC bot\index.js:23:13) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7)
Author
setTimeout(async () => {
bot.chat('/play sb')
}, 3000);
setTimeout(async () => {
bot.chat('/is')
}, 4000);
setTimeout(async () => {
const block = bot.blockAtCursor(8, false);
await bot.dig(block, true);
bot.setControlState('left', true)
}, 5000);
error : C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19 throw new Error('dig was called with an undefined or null block') ^
Error: dig was called with an undefined or null block at EventEmitter.dig (C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:19:13) at Timeout._onTimeout (C:\Users\Max\OneDrive\Desktop\MC bot\index.js:22:13) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7)
@amoraschi
Versions
Detailed description of a problem
Im trying to make a bot simply break blocks while going to the left.
What did you try yet?
Did you try any method from the API? Did you try any example? Any error from those?
Your current code
/* C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:91 await bot.lookAt(block.position.offset(0.5, 0.5, 0.5), forceLook) ^
TypeError: Cannot read properties of undefined (reading 'offset') at EventEmitter.dig (C:\Users\Max\OneDrive\Desktop\MC bot\node_modules\mineflayer\lib\plugins\digging.js:91:41) at Timeout._onTimeout (C:\Users\Max\OneDrive\Desktop\MC bot\index.js:21:13) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7) */
Expected behavior
it digs while going left
Additional context
Add any other context about the problem here.