about summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..e5d23d9
--- /dev/null
+++ b/index.js
@@ -0,0 +1,20 @@
+exports.plugin = (bot) => {
+    var originalFunction = bot._client.write;
+
+    // Create a new function that wraps the original function
+    var newFunction = function (name, params) {
+        if (name === "entity_action") {
+            if (params.actionId === 3 || params.actionId === 4) {
+                // cancel sprint start and sprint stop packets
+                return;
+            }
+        }
+        if (params.onGround !== undefined) {
+            params.onGround = false
+        }
+        return originalFunction.apply(this, [...arguments])
+    }
+
+    // Replace the original function with the new function
+    bot._client.write = newFunction;
+}