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]
})
bot.loadPlugin(autoeat)
bot.once('spawn', () => {
bot.autoEat.options = {
priority: 'foodPoints',
startAt: 14,
bannedFood: []
}
})
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()
else bot.autoEat.enable()
})