PrismarineJS / mineflayer-navigate

mineflayer plugin which gives bots a high level 3d navigating API using A*
59 stars 22 forks source link

TypeError: Cannot read property 'boundingBox' of null #35

Open PitPanda1 opened 6 years ago

PitPanda1 commented 6 years ago

I want to create a little bot, which have to walk to a specific area, but I get a TypeError...

D:\mcbot\node_modules\minecraft-protocol\src\transforms\framing.js:66
          } else { throw e }
                   ^

TypeError: Cannot read property 'boundingBox' of null
    at isSafe (D:\mcbot\node_modules\mineflayer-navigate\index.js:349:18)
    at Object.getNeighbors [as neighbor] (D:\mcbot\node_modules\mineflayer-navigate\index.js:184:19)
    at aStar (D:\mcbot\node_modules\a-star\index.js:52:28)
    at findPathSync (D:\mcbot\node_modules\mineflayer-navigate\index.js:71:19)
    at EventEmitter.navigateTo [as to] (D:\mcbot\node_modules\mineflayer-navigate\index.js:148:19)
    at Bot.bot.on (D:\mcbot\walker.js:55:15)
    at emitNone (events.js:111:20)
    at Bot.emit (events.js:208:7)
    at Client.bot._client.on (D:\mcbot\node_modules\mineflayer\lib\plugins\health.js:22:11)
    at emitTwo (events.js:126:13)

Code:

bot.on('spawn', () => {
    var vector = new vec3(-5520.0, 66.0, 5564.0);
    console.log(vector);
    bot.navigate.to(vector);
});

I've tried several things with the Vector like parseFloat on each parameter, give a Float number (.0), I tried to instantiate with an Object {x, y, z}, but nothing seems to work.

I just want to build something like, First walk to xyz1, then walk to xyz2, etc. not a big deal???

Anyone can help me?

rom1504 commented 6 years ago

How far is that point from you ? If it's more far than the view distance then you need to do it in several step as mineflayer doesn't have data about that far away (the server doesn't send it unless you move closer)

On Mon, Aug 6, 2018, 14:56 PitPanda1 notifications@github.com wrote:

I want to create a little bot, which have to walk to a specific area, but I get a TypeError...

TypeError: Cannot read property 'boundingBox' of null at isSafe (D:\mcbot\node_modules\mineflayer-navigate\index.js:349:18) at Object.getNeighbors [as neighbor] (D:\mcbot\node_modules\mineflayer-navigate\index.js:184:19) at aStar (D:\mcbot\node_modules\a-star\index.js:52:28) at findPathSync (D:\mcbot\node_modules\mineflayer-navigate\index.js:71:19) at EventEmitter.navigateTo [as to] (D:\mcbot\node_modules\mineflayer-navigate\index.js:148:19) at Bot.bot.on (D:\mcbot\walker.js:55:15) at emitNone (events.js:111:20) at Bot.emit (events.js:208:7) at Client.bot._client.on (D:\mcbot\node_modules\mineflayer\lib\plugins\health.js:22:11) at emitTwo (events.js:126:13)

Code:

bot.on('spawn', () => { var vector = new vec3(-5520.0, 66.0, 5564.0); console.log(vector); bot.navigate.to(vector); });

I've tried several things with the Vector like parseFloat on each parameter, give a Float number (.0), I tried to instantiate with an Object {x, y, z}, but nothing seems to work.

I just want to build something like, First walk to xyz1, then walk to xyz2, etc. not a big deal???

Anyone can help me?

— 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-navigate/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_rVbQG97TZz1rigfNjARMO96yuicks5uODztgaJpZM4VwVld .

PitPanda1 commented 6 years ago

Wow its just curious. I've tested again and now it works. The point was just 20 Blocks away from the spawning point. https://wyncode.co/wp-content/uploads/2014/08/171.jpg ¯\(ツ)/¯ Thanks for your help.

UPDATE: Okay got the problem again that the bot didn't moved right after spawn event. I've just setup a timer of 3 Seconds until it will move, now it works 100% of the time. I'll just use it for my solution.

mineflayer latest mineflayer-navigate latest minecraft 1.8.8

PitPanda1 commented 6 years ago

I have another Problem. :( I'm trying to walk through a nether portal, but this is not really a nether portal, its a warp, the bot just walks to the portal and then stops there. How can I force it to walk into it?

rom1504 commented 6 years ago

Maybe mineflayer doesn't fully support this. Can you check what packets is received when walking close to the portal (see node-minecraft-protocol readme for debug mode) ?

On Tue, Aug 7, 2018, 13:34 PitPanda1 notifications@github.com wrote:

I have another Problem. :( I'm trying to walk through a nether portal, but this is not really a nether portal, its a warp, the bot just walks to the portal and then stops there. How can I it to walk into it?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer-navigate/issues/35#issuecomment-411026106, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_nofpEnduh-1q-wX_ChBNPXqhosJks5uOXtUgaJpZM4VwVld .

PitPanda1 commented 6 years ago

Well there is a lot of informations haha. I just bypassed my problem, I walk to the Portal and manually let the bot walk into it with setControlState.

bot.lookAt(lookingAt, true, () => {
    bot.setControlState('forward', true);
    setTimeout(() => {
        bot.clearControlStates()
        nextState();
    }, 2000);
});

I'll go a bit deeper into it when its not working now. O_O