Code: Select all
bot.on('path_update', (r) => {
console.log('Goal updated');
});
bot.on('goal_reached', (goal) => {
console.log('Here I am');
});
else if (message.startsWith('goto')) {
const cmd = message.split('');
if (cmd.length === 4) {
const x = parseInt(cmd[1], 10);
const y = parseInt(cmd[2], 10);
const z = parseInt(cmd[3], 10);
bot.pathfinder.setMovements(DefaultMove);
bot.pathfinder.setGoal(new GoalBlock(x, y, z));
} else if (cmd.length === 3) {
const x = parseInt(cmd[1], 10);
const z = parseInt(cmd[3], 10);
bot.pathfinder.setMovements(DefaultMove);
bot.pathfinder.setGoal(new GoalXZ(x, z));
} else if (cmd.length === 2) {
const y = parseInt(cmd[1], 10);
bot.pathfinder.setMovements(DefaultMove);
bot.pathfinder.setGoal(new GoalY(y));
}
}
Hier ist ein Ausschnitt des „goto“-Ereignisses, bei dem ich „goto [x] [y] [z]' Ich möchte, dass der Bot zu dieser bestimmten Koordinate in der Minecraft-Welt geht.
Als ich das Ereignis jedoch versuchte, geschah dies nicht einmal Registrieren Sie sich im Terminal, was mich vermuten lässt, dass mit diesem Teil etwas nicht stimmt des Codes.
Code: Select all
else if (message.startsWith('goto'))
Ich habe versucht, den tatsächlichen Code aus dem Mineflayer-Pathfinder-Github zu suchen und sogar durch Kopieren einzufügen Seite selbst, aber es ist immer noch funktioniert nicht
Hier ist ein Video, in dem ich das Problem reproduziere
https://imgur.com/a/IFb1gak