diff options
Diffstat (limited to 'src/antihunger.ts')
-rw-r--r-- | src/antihunger.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/antihunger.ts b/src/antihunger.ts new file mode 100644 index 0000000..d63b3ca --- /dev/null +++ b/src/antihunger.ts @@ -0,0 +1,22 @@ +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 |