README
mineflayer-auto-eat
An auto eat plugin for mineflayer
Install
npm install mineflayer-auto-eat
Example
const mineflayer = require("mineflayer")
const autoeat = require("mineflayer-auto-eat")
const bot = mineflayer.createBot({
host: process.argv[2],
port: process.argv[3],
username: process.argv[4],
password: process.argv[5],
})
// Load the plugin
bot.loadPlugin(autoeat)
bot.once("spawn", () => {
bot.autoEat.options.priority = "foodPoints"
bot.autoEat.options.bannedFood = []
bot.autoEat.options.eatingTimeout = 3
})
// The bot eats food automatically and emits these events when it starts eating and stops eating.
bot.on("autoeat_started", () => {
console.log("Auto Eat started!")
})
bot.on("autoeat_stopped", () => {
console.log("Auto Eat stopped!")
})
bot.on("health", () => {
if (bot.food === 20) bot.autoEat.disable()
// Disable the plugin if the bot is at 20 food points
else bot.autoEat.enable() // Else enable the plugin again
})
API
Properties
bot.autoEat
Includes Objects
bot.autoEat.options
Can be changed to change the settings for the auto eat plugin (Can only be changed when the bot has spawned or else you get an Error)
Example
bot.once("spawn", () => {
bot.autoEat.options = {
priority: "saturation",
startAt: 16,
bannedFood: ["golden_apple", "enchanted_golden_apple", "rotten_flesh"],
}
})
bot.autoEat.options.priority
Acceptable Values are "saturation", "foodPoints" or "effectiveQuality"
default: "foodPoints"
bot.autoEat.options.startAt
If the bot has less food points than that number, it will start eating
default: 14
bot.autoEat.options.bannedFood
The bot will not eat the items in the array unless they are the only items available
default: []
bot.autoEat.options.ignoreInventoryCheck
Forces bot to disable inventory window click confirmation. Related to PrismarineJS/mineflayer#2030
default: false
bot.autoEat.options.checkOnItemPickup
Attempts to find food in inventory on item pickup
default: false
bot.autoEat.options.eatingTimeout
Timeout of food consumption. If eating takes too long, we're assuming that it is finished after that time. Time in seconds, null or negative value means "no timeout".
default: 3
Methods
bot.autoEat.enable()
Calling this function will enable the plugin (its enabled by default ofc)
bot.autoEat.disable()
Calling this function will disable the plugin
bot.autoEat.eat()
If you want to call the eat function manually you can do it like this below
bot.autoEat.eat(function (err) {
if (err) {
console.error(err)
} else {
console.log('Success!')
}
})
Author
👤 Link#0069
- Github: @LINKdiscordd
Show your support
Give a ⭐️ if this plugin helped you!
This README was generated with ❤️ by readme-md-generator