about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-15 13:12:38 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-15 13:12:38 +0100
commit5abdd4f89c39262659a7e1532de3fd2749e4835c (patch)
treec8190f15714f92b029259b1ba3563b0586dc0eda /src
parentMisc: Cleanup shell.nix (diff)
download2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.tar.gz
2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.tar.bz2
2bored2walk-5abdd4f89c39262659a7e1532de3fd2749e4835c.zip
Misc: Use now upstreamed 'mineflayer-antihunger' plugin
:^)
Diffstat (limited to 'src')
-rw-r--r--src/antihunger.ts22
-rw-r--r--src/main.ts2
2 files changed, 1 insertions, 23 deletions
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)