Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seemingly random crashes "Cannot read property 'y' of undefined" #83

Closed
L3g7 opened this issue Dec 7, 2020 · 1 comment
Closed

Seemingly random crashes "Cannot read property 'y' of undefined" #83

L3g7 opened this issue Dec 7, 2020 · 1 comment

Comments

@L3g7
Copy link

L3g7 commented Dec 7, 2020

My bot sometimes throws the error

[11:30:54] [AUTORECONNECT] Moving to area
D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:81
        height: pos.y + dy
                    ^

TypeError: Cannot read property 'y' of undefined
    at Movements.getBlock (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:81:21)
    at Movements.safeToBreak (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:101:16)
    at Movements.safeOrBreak (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:113:15)
    at Movements.getMoveDiagonal (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:204:18)
    at Movements.getNeighbors (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\movements.js:350:12)
    at AStar.compute (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\lib\astar.js:76:40)
    at Object.bot.pathfinder.getPathTo (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\index.js:39:84)
    at Bot.monitorMovement (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer-pathfinder\index.js:210:26)
    at Bot.emit (events.js:326:22)
    at Timeout.doPhysics [as _onTimeout] (D:\prg\FlayBot_v0.8.9\node_modules\mineflayer\lib\plugins\physics.js:62:13)
Drücken Sie eine beliebige Taste . . . 

(Almost) all i have is:

logger.autoreconnect("Moving to area");
var botOptions = {
    host: this.server,
    port: this.port == null ? "25565" : this.port,
    username: this.username,
    password: this.password,
    version: this.version == null ? "1.8.8" : this.version
}

var bot = mineflayer.createBot(botOptions);
bot.loadPlugin(pathfinder);
const mcData = require('minecraft-data')(bot.version);
var defaultMove = new Movements(bot, mcData);
defaultMove.blocksToAvoid.add(mcData.blocksByName.iron_trapdoor.id);
pathfinder(bot)
bot.pathfinder.setMovements(defaultMove);

bot.once('spawn', () => {
    bot.pathfinder.setGoal(new GoalNear(317, 116, 305, 1))
});

Usually, this works, but sometimes, seemingly random, the bot crashes and throws the error shown above.
What am i doing wrong?

@Karang
Copy link
Collaborator

Karang commented Dec 7, 2020

You need to update the package. This bug was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants