about summary refs log tree commit diff
path: root/src/main.ts
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-15 19:12:30 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-15 19:12:30 +0100
commitfd6992e38b100cb90228d5b72db96e45b5bfd27b (patch)
treea1da4dfbc864b197cab0529e2ca1afd5175c05f2 /src/main.ts
parentMisc: Use now upstreamed 'mineflayer-antihunger' plugin (diff)
download2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.tar.gz
2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.tar.bz2
2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.zip
Bot: Add autoArmor plugin
Diffstat (limited to '')
-rw-r--r--src/main.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.ts b/src/main.ts
index 97c982b..0a28ea4 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -2,9 +2,10 @@ import 'dotenv/config';
 import mineflayer from 'mineflayer';
 import { ChannelType, Client, GatewayIntentBits } from "discord.js";
 const mineflayerViewer = require('prismarine-viewer').mineflayer
-const antihunger = require('mineflayer-antihunger').plugin
+const antiHunger = require('mineflayer-antihunger').plugin
 import { pathfinder, Movements, goals } from 'mineflayer-pathfinder';
 import { plugin as autoeat } from 'mineflayer-auto-eat';
+import autoArmor from '@nxg-org/mineflayer-auto-armor';
 
 const hostname: string = "localhost"
 const goal: goals.Goal = new goals.GoalNear(0, 60, -2000000, 44)
@@ -41,15 +42,16 @@ discordClient.once("ready", () => {
 
 const bot = mineflayer.createBot({
   host: hostname,
-  port: 25565,
-  username: process.env.MINECRAFT_EMAIL as string,
+  port: 37253,
+  username: "s",//process.env.MINECRAFT_EMAIL as string,
   version: "1.12.2",
   auth: 'microsoft'
 })
 
 bot.loadPlugin(pathfinder)
 bot.loadPlugin(autoeat)
-bot.loadPlugin(antihunger)
+bot.loadPlugin(antiHunger)
+bot.loadPlugin(autoArmor)
 
 bot.once('spawn', () => {
   mineflayerViewer(bot, { firstPerson: true, port: 3000 });
@@ -60,6 +62,8 @@ bot.once('spawn', () => {
   (bot as any).autoEat.options.priority = 'saturation';
   (bot as any).autoEat.options.startAt = 16;
 
+  (bot as any).autoArmor.checkOnItemPickup = true;
+
   (bot as any).pathfinder.setMovements(defaultMove);
   (bot as any).pathfinder.setGoal(goal);