diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-15 13:12:38 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-15 13:12:38 +0100 |
commit | 5abdd4f89c39262659a7e1532de3fd2749e4835c (patch) | |
tree | c8190f15714f92b029259b1ba3563b0586dc0eda | |
parent | Misc: Cleanup shell.nix (diff) | |
download | 2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.tar.gz 2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.tar.bz2 2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.zip |
Misc: Use now upstreamed 'mineflayer-antihunger' plugin
:^)
-rw-r--r-- | package-lock.json | 11 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/antihunger.ts | 22 | ||||
-rw-r--r-- | src/main.ts | 2 |
4 files changed, 13 insertions, 23 deletions
diff --git a/package-lock.json b/package-lock.json index f1b3026..1d11f1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "discord.js": "^14.7.1", "dotenv": "^16.0.3", "mineflayer": "^4.8.1", + "mineflayer-antihunger": "^1.0.4", "mineflayer-auto-eat": "^3.3.1", "mineflayer-pathfinder": "github:PrismarineJS/mineflayer-pathfinder", "prismarine-viewer": "^1.23.0" @@ -1172,6 +1173,11 @@ "node": ">=14" } }, + "node_modules/mineflayer-antihunger": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mineflayer-antihunger/-/mineflayer-antihunger-1.0.4.tgz", + "integrity": "sha512-MS7ErJEuMG4Kiy3fO/BtU3O5Jd98NrdlAz95tDeZbLBHWcT1Y9WrHJ/+d5Ny+EAdUriZSe5BppccVrULWzPDFg==" + }, "node_modules/mineflayer-auto-eat": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/mineflayer-auto-eat/-/mineflayer-auto-eat-3.3.1.tgz", @@ -2973,6 +2979,11 @@ "vec3": "^0.1.7" } }, + "mineflayer-antihunger": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mineflayer-antihunger/-/mineflayer-antihunger-1.0.4.tgz", + "integrity": "sha512-MS7ErJEuMG4Kiy3fO/BtU3O5Jd98NrdlAz95tDeZbLBHWcT1Y9WrHJ/+d5Ny+EAdUriZSe5BppccVrULWzPDFg==" + }, "mineflayer-auto-eat": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/mineflayer-auto-eat/-/mineflayer-auto-eat-3.3.1.tgz", diff --git a/package.json b/package.json index 72ef83d..3dd1cfd 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "discord.js": "^14.7.1", "dotenv": "^16.0.3", "mineflayer": "^4.8.1", + "mineflayer-antihunger": "^1.0.4", "mineflayer-auto-eat": "^3.3.1", "mineflayer-pathfinder": "github:PrismarineJS/mineflayer-pathfinder", "prismarine-viewer": "^1.23.0" diff --git a/src/antihunger.ts b/src/antihunger.ts deleted file mode 100644 index d63b3ca..0000000 --- a/src/antihunger.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Bot } from "mineflayer"; - -export function plugin(bot: Bot) { - var originalFunction = bot._client.write; - - // Create a new function that wraps the original function - var newFunction = function (this: unknown, name: string, params: any) { - if (name === "entity_action") { - if (params.actionId === 3 || params.actionId === 4) { - // cancel sprint start and sprint stop packets - return; - } - } - if (name === 'position_look' || name === 'position') { - params.onGround = false - } - return originalFunction.apply(this, [...arguments] as [name: string, params: any]) - } - - // Replace the original function with the new function - bot._client.write = newFunction; -} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 896ecee..97c982b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,9 +2,9 @@ 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 import { pathfinder, Movements, goals } from 'mineflayer-pathfinder'; import { plugin as autoeat } from 'mineflayer-auto-eat'; -import { plugin as antihunger } from './antihunger' const hostname: string = "localhost" const goal: goals.Goal = new goals.GoalNear(0, 60, -2000000, 44) |