Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. var mineflayer = require('mineflayer');
  2. var navigatePlugin = require('mineflayer-navigate')(mineflayer);
  3.  
  4. var bot = mineflayer.createBot({
  5. host: "play.mineraze.us", // optional
  6. port: 25565, // optional
  7. username: "", // email and password are required only for
  8. password: "", // online-mode=true servers
  9. });
  10.  
  11.  
  12. bot.on('spawn', function() {
  13. var target = bot.players['TheTechPony'].entity;
  14. bot.navigate.to(target.position);
  15. });
  16.  
  17. bot.on('kick', function(message) {
  18. console.log(message)
  19. });
  20.  
  21. navigatePlugin(bot);
  22. // optional configuration
  23. bot.navigate.blocksToAvoid[132] = true; // avoid tripwire
  24. bot.navigate.blocksToAvoid[59] = false; // ok to trample crops
  25. bot.navigate.on('pathFound', function (path) {
  26. bot.chat("found path. I can get there in " + path.length + " moves.");
  27. });
  28. bot.navigate.on('cannotFind', function (closestPath) {
  29. bot.chat("unable to find path. getting as close as possible");
  30. bot.navigate.walk(closestPath);
  31. });
  32. bot.navigate.on('arrived', function () {
  33. bot.chat("I have arrived");
  34. });
  35. bot.navigate.on('interrupted', function() {
  36. bot.chat("stopping");
  37. });
  38. bot.on('chat', function(username, message) {
  39. console.log('chat dinged')
  40. // navigate to whoever talks
  41. if (username === bot.username) return;
  42. var target = bot.players[username].entity;
  43. if (message === 'come') {
  44. bot.navigate.to(target.position);
  45. } else if (message === 'stop') {
  46. bot.navigate.stop();
  47. }
  48. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement