diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-15 19:12:30 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-15 19:12:30 +0100 |
commit | fd6992e38b100cb90228d5b72db96e45b5bfd27b (patch) | |
tree | a1da4dfbc864b197cab0529e2ca1afd5175c05f2 | |
parent | Misc: Use now upstreamed 'mineflayer-antihunger' plugin (diff) | |
download | 2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.tar.gz 2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.tar.bz2 2bored2walk-fd6992e38b100cb90228d5b72db96e45b5bfd27b.zip |
Bot: Add autoArmor plugin
-rw-r--r-- | package-lock.json | 27 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/main.ts | 12 |
3 files changed, 36 insertions, 4 deletions
diff --git a/package-lock.json b/package-lock.json index 1d11f1a..5206963 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "@nxg-org/mineflayer-auto-armor": "^1.1.0", "discord.js": "^14.7.1", "dotenv": "^16.0.3", "mineflayer": "^4.8.1", @@ -85,6 +86,19 @@ "node": ">=16.9.0" } }, + "node_modules/@nxg-org/mineflayer-auto-armor": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@nxg-org/mineflayer-auto-armor/-/mineflayer-auto-armor-1.1.0.tgz", + "integrity": "sha512-C1ab2Qe6QmCkhbloMyIr0Zpi4L4Z5d4lr8SamPuMmH09MfFyBkDQXeffaEDh/WU55lderXRpmAYVdOhPy/AhiQ==", + "dependencies": { + "@nxg-org/mineflayer-util-plugin": "^1.7.9" + } + }, + "node_modules/@nxg-org/mineflayer-util-plugin": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/@nxg-org/mineflayer-util-plugin/-/mineflayer-util-plugin-1.7.9.tgz", + "integrity": "sha512-KGniVUnJcUdYkIcTxBv86BJWZv2ykSWsrhC/TuVkj2FtdfYj5bo/oD3OQH6CFww1V36FDol9Xr6PmC5/DgzExw==" + }, "node_modules/@sapphire/async-queue": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", @@ -2169,6 +2183,19 @@ "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-0.1.0.tgz", "integrity": "sha512-e7d+PaTLVQav6rOc2tojh2y6FE8S7REkqLldq1XF4soCx74XB/DIjbVbVLtBemf0nLW77ntz0v+o5DytKwFNLQ==" }, + "@nxg-org/mineflayer-auto-armor": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@nxg-org/mineflayer-auto-armor/-/mineflayer-auto-armor-1.1.0.tgz", + "integrity": "sha512-C1ab2Qe6QmCkhbloMyIr0Zpi4L4Z5d4lr8SamPuMmH09MfFyBkDQXeffaEDh/WU55lderXRpmAYVdOhPy/AhiQ==", + "requires": { + "@nxg-org/mineflayer-util-plugin": "^1.7.9" + } + }, + "@nxg-org/mineflayer-util-plugin": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/@nxg-org/mineflayer-util-plugin/-/mineflayer-util-plugin-1.7.9.tgz", + "integrity": "sha512-KGniVUnJcUdYkIcTxBv86BJWZv2ykSWsrhC/TuVkj2FtdfYj5bo/oD3OQH6CFww1V36FDol9Xr6PmC5/DgzExw==" + }, "@sapphire/async-queue": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", diff --git a/package.json b/package.json index 3dd1cfd..a48ff02 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "@nxg-org/mineflayer-auto-armor": "^1.1.0", "discord.js": "^14.7.1", "dotenv": "^16.0.3", "mineflayer": "^4.8.1", 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); |