question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with Mineflayer 4.5.1?

See original GitHub issue

Using the latest version of Mineflayer and Pathfinder.

TypeError: Cannot read properties of undefined (reading 'blocksByName')
    at new Movements (F:\PC\Projects\BotSorter\node_modules\mineflayer-pathfinder\lib\movements.js:43:39)
    at StorageBot.start (F:\PC\Projects\BotSorter\src\bot\storageBot.js:26:24)
    at F:\PC\Projects\BotSorter\index.js:24:9
    at Array.forEach (<anonymous>)
    at F:\PC\Projects\BotSorter\index.js:17:14
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (F:\PC\Projects\BotSorter\index.js:9:8)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)

I’ve seen no other complaints about this so I feel it’s only me experiencing the issue. Any ideas of why this is happening?

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Dufftwtcommented, Dec 16, 2022

Using the latest version of Mineflayer and Pathfinder.

TypeError: Cannot read properties of undefined (reading 'blocksByName')
    at new Movements (F:\PC\Projects\BotSorter\node_modules\mineflayer-pathfinder\lib\movements.js:43:39)
    at StorageBot.start (F:\PC\Projects\BotSorter\src\bot\storageBot.js:26:24)
    at F:\PC\Projects\BotSorter\index.js:24:9
    at Array.forEach (<anonymous>)
    at F:\PC\Projects\BotSorter\index.js:17:14
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (F:\PC\Projects\BotSorter\index.js:9:8)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)

I’ve seen no other complaints about this so I feel it’s only me experiencing the issue. Any ideas of why this is happening?

Okay, I’ve just figured it out, the bot needs to be completely spawned before defining using new Movements(bot) so wait for the bot.on(“spawn”,…) the reason why it didn’t work like before is because now they use bot.registry, and it seems the bot needs to be fully spawned to be able to access it

0reactions
Matt-MXcommented, Dec 20, 2022

I got it working now, I simply just applied the movement on the spawn event, like https://github.com/PrismarineJS/mineflayer-pathfinder/issues/305#issuecomment-1354057386

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to connect to server #2838 - GitHub
... resolution to my issue Versions mineflayer: 4.5.1 server: vanilla 1.19.41 node: v18.12.1 Detailed description of a problem I'm trying to ...
Read more >
PrismarineJS/mineflayer - Gitter
<CallMeOPG> yoo I'm currently stuck with a command bot project. How can i get and chat the position of the bot? <AshIsNotok> ...
Read more >
Getting Started with Mineflayer [Beginner Tutorial] - YouTube
Mineflayer is an open-source project created by the PrismarineJS community. If you're interested in finding out more information about ...
Read more >
mineflayer - npm
Latest version: 4.5.1, last published: 20 days ago. Start using mineflayer in your project by running `npm i mineflayer`.
Read more >
Mineflayer - Browse Files at SourceForge.net
Collect, search, and correlate detailed logs from applications, infrastructure, and network devices for faster troubleshooting and investigation. Get to the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found