-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Can anybody help me?
This is what my rbot.js looks like. it joins a server. the last message i got is Position 1 erreicht but he never walk anywere he joins the /portal but then do nothing.
`#!/usr/bin/env node
if(process.argv.length<5 || process.argv.length>7)
{
console.log("Usage : rbot [] []");
process.exit(1);
}
var mineflayer = require('mineflayer');
var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer);
var navigatePlugin = require('mineflayer-navigate')(mineflayer);
var navigate2Plugin = require('./avoidBedrock.js')(mineflayer);
var async=require('async');
var vec3 = require('vec3');
var bot = mineflayer.createBot({
username: process.argv[4],
verbose: true,
version: "1.8.9",
port:parseInt(process.argv[3]),
host:process.argv[2],
password:process.argv[5]
});
navigatePlugin(bot);
navigate2Plugin(bot);
blockFinderPlugin(bot);
var task=require('./task');
var achieve=require('./achieve');
task.init(bot,vec3,achieve.achieve,achieve.achieveList,achieve.processMessage,mineflayer,async);
achieve.init(task.all_task.tasks,task.all_task.giveUser,task.all_task.parameterized_alias,task.all_task.alias,task.all_task.stringTo,bot,vec3,process.argv[6]);
bot.on('login', function() {
console.log("I logged in.");
console.log(bot.entity.position)
console.log("settings", bot.settings);
console.log("game", bot.game);
console.log("Bot is eingeloggt");
console.log("Bot befindet sich im /hub")
bot.chat('/portal');
console.log(bot.entity.position)
console.log("Erfolgreich zum Portal verbunden!");
setTimeout(() => {
const portalPos = vec3(310, 117, 260);
const pos1 = vec3(315, 117, 264);
const pos2 = vec3(308, 117, 260);
const navigateToPos1 = () => {
bot.navigate.on('arrived', () => {
setTimeout(() => {
}, 500);
});
console.log(bot.entity.position)
bot.navigate.to(pos1);
console.log("Position 1 erreicht")
console.log(bot.entity.position)
}
const navigateToPos2 = () => {
bot.navigate.on('arrived', () => {
setTimeout(() => {
enterPortal();
}, 500);
});
bot.navigate.to(pos2);
console.log(bot.entity.position)
console.log("Position 2 erreicht")
}
const enterPortal = () => {
bot.lookAt(portalPos, true);
console.log("LookAt Portal")
bot.once('spawn', () => {
bot.clearControlStates();
console.log("Bot geht zu seinem Home");
setTimeout(() => {
console.log("....");
bot.chat('/p h');
}, 1500);
});
bot.setControlState('sprint', true);
bot.setControlState('forward', true);
bot.setControlState('jump', true);
console.log("Enter Portal")
}
navigateToPos1();
}, 12000);
});
bot.on('death', function() {
bot.chat("I died x.x");
});
bot.on('chat',function(username,message){achieve.processMessage(message,username,function(err){if(!err) bot.chat("I "+(!err ? "achieved" : "failed")+" task "+message);});});
bot.navigate.on('pathFound', function (path) {
console.log("found path. I can get there in " + path.length + " moves.");
});
bot.navigate.on('cannotFind', function () {
console.log("unable to find path");
});
bot.on('health', function() {
console.log("I have " + bot.health + " health and " + bot.food + " food");
});
bot.on('kicked', function(reason) {
console.log("I got kicked for", reason, "lol");
});
bot.on('nonSpokenChat', function(message) {
console.log("non spoken chat", message);
});
`