Closed hatkidchan closed 3 years ago
Did you test this
Did you test this
Yep, seems to work. Used that code for testing:
const mineflayer = require("mineflayer")
const autoeat = require("./index")
const bot = mineflayer.createBot({
host: process.argv[2],
port: process.argv[3],
username: process.argv[4]
})
bot.loadPlugin(autoeat)
bot.once("spawn", () => {
bot.autoEat.options.startAt = 20
bot.autoEat.options.checkOnItemPickup = true
bot.autoEat.options.ignoreInventoryCheck = true
})
bot.on("autoeat_started", (item) => {
console.log(`Started eating ${item.displayName}`)
})
bot.on("autoeat_stopped", (err) => {
console.log(`Stopped eating with error ${err}`)
})
bot.on("health", () => {
console.log(`HP: ${bot.health} ST: ${bot.food}`);
if (bot.food === 20) bot.autoEat.disable()
else bot.autoEat.enable()
})
LGTM!
Also that may be not your fault and problem lies in https://github.com/PrismarineJS/mineflayer/issues/2030, but still there are some changes that you may find helpful