Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mineflayer = require('mineflayer');
- var navigatePlugin = require('mineflayer-navigate')(mineflayer);
- var bot = mineflayer.createBot({
- host: "play.mineraze.us", // optional
- port: 25565, // optional
- username: "", // email and password are required only for
- password: "", // online-mode=true servers
- });
- bot.on('spawn', function() {
- var target = bot.players['TheTechPony'].entity;
- bot.navigate.to(target.position);
- });
- bot.on('kick', function(message) {
- console.log(message)
- });
- navigatePlugin(bot);
- // optional configuration
- bot.navigate.blocksToAvoid[132] = true; // avoid tripwire
- bot.navigate.blocksToAvoid[59] = false; // ok to trample crops
- bot.navigate.on('pathFound', function (path) {
- bot.chat("found path. I can get there in " + path.length + " moves.");
- });
- bot.navigate.on('cannotFind', function (closestPath) {
- bot.chat("unable to find path. getting as close as possible");
- bot.navigate.walk(closestPath);
- });
- bot.navigate.on('arrived', function () {
- bot.chat("I have arrived");
- });
- bot.navigate.on('interrupted', function() {
- bot.chat("stopping");
- });
- bot.on('chat', function(username, message) {
- console.log('chat dinged')
- // navigate to whoever talks
- if (username === bot.username) return;
- var target = bot.players[username].entity;
- if (message === 'come') {
- bot.navigate.to(target.position);
- } else if (message === 'stop') {
- bot.navigate.stop();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement