about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-15 12:50:51 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-16 01:39:39 +0100
commitb00ce694f03143a92463cc2b438461d8ee8c9250 (patch)
treef1fdf7f70c2ea02443c7a9fe56dca3d1e1b82667
downloadmineflayer-antihunger-b00ce694f03143a92463cc2b438461d8ee8c9250.tar.gz
mineflayer-antihunger-b00ce694f03143a92463cc2b438461d8ee8c9250.tar.bz2
mineflayer-antihunger-b00ce694f03143a92463cc2b438461d8ee8c9250.zip
Initial commit
-rw-r--r--LICENSE24
-rw-r--r--README.md2
-rw-r--r--index.js20
-rw-r--r--package.json25
4 files changed, 71 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0321293
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+BSD 2-Clause License
+
+Copyright (c) 2023, Baitinq
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..27c9aa5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# mineflayer-antihunger
+Adds antihunger functionality to your mineflayer bot (Tested on 1.12)
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;
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..f4eac0e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+  "name": "mineflayer-antihunger",
+  "version": "1.0.5",
+  "description": "Adds antihunger functionality to your mineflayer bot (Tested on 1.12)",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/Baitinq/mineflayer-antihunger.git"
+  },
+  "keywords": [
+    "mineflayer",
+    "plugin",
+    "antihunger",
+    "bot"
+  ],
+  "author": "Baitinq",
+  "license": "BSD-2-Clause",
+  "bugs": {
+    "url": "https://github.com/Baitinq/mineflayer-antihunger/issues"
+  },
+  "homepage": "https://github.com/Baitinq/mineflayer-antihunger#readme"
+}