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.

Cannot override bot.findBlock

See original GitHub issue

Greetings,

I just installed https://github.com/Darthfett/mineflayer-blockFinder and after debugging my project I noticed that its implementation is always ignored in favor of the one in mineflayer.

Here’s some code snippets:

My project’s code:

var bot = mineflayer.createBot({
...
});

// Install the plugin - method override is done here
blockFinderPlugin(bot);

// Sample usage
bot.once('spawn', function() {
  bot.findBlock(...) // the original findBlock is called instead of the plugin`s
});

The injection function blockFinderPlugin is successfully called and the override code also succeeds:

        function findBlockSync(options) {
...
        }

        function findBlock(options, callback) {
...
        }

        bot.findBlock = findBlock;
        bot.findBlockSync = findBlockSync;  

Yet the original function is always called instead. I don’t know if the issue belongs here or at the plugin dev’s repo, so apologies if this isn’t meant for here.

Cheers

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rom1504commented, Jun 23, 2017

Ah yes, this is due to the new version system which guess the version and load the plugin afterwards. That should be fixed somehow

On Fri, Jun 23, 2017, 18:56 ViR Dash notifications@github.com wrote:

Greetings,

I just installed https://github.com/Darthfett/mineflayer-blockFinder http://mineflayer-blockFinder and after debugging my project I noticed that its implementation is always ignored in favor of the one in mineflayer.

Here’s some code snippets:

My project’s code:

var bot = mineflayer.createBot({ … });

// Install the plugin - method override is done here blockFinderPlugin(bot);

// Sample usage bot.once(‘spawn’, function() { bot.findBlock(…) // the original findBlock is called instead of the plugin`s });

The injection function blockFinderPlugin is successfully called and the override code also succeeds:

    function findBlockSync(options) {

… }

    function findBlock(options, callback) {

… }

    bot.findBlock = findBlock;
    bot.findBlockSync = findBlockSync;

Yet the original function is always called instead. I don’t know if the issue belongs here or at the plugin dev’s repo, so apologies if this isn’t meant for here.

Cheers

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/539, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_h039POG-xwICrOpJsuw4Tl4hmTfks5sG-42gaJpZM4ODzwz .

0reactions
rom1504commented, Jun 26, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

PrismarineJS/mineflayer - Gitter
Create Minecraft bots with a powerful, stable, and high level JavaScript API. People. Repo info.
Read more >
Why doesn't my code wait for the callback
I have a function that locates a block and goes to it with the help of the mineflayer-pathfinder module. Now my problem, after...
Read more >
PrismarineJS/mineflayer (Raised $103.00)
bot unable to open most blocks that have a gui ... Bot cant chat on spawn ... SkinRestorer plugin: Some mineflayer features don't...
Read more >
How to block spam messages on WhatsApp
Find "block contact" and "report contact" at the bottom. Credit: Screengrab: whatsapp. Go to the message thread that contains the spam ...
Read more >
How to Unblock Someone on Discord on Desktop or Mobile
If you don't share a server with this person, or can't find one of their messages, you can unblock them directly from your...
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