How do i fix this i been trying to solve this. Here the code
const mineflayer = require('mineflayer');
const autoVersionForge = require('minecraft-protocol-forge').autoVersionForge;
const bot = mineflayer.createBot({
host: 'server

',
username: 'Matt',
version: false // Allow autoVersionForge to handle the version
});
autoVersionForge(bot._client);
bot.on('spawn', () => {
console.log('Bot spawned!');
bot.chat('Hi, I am Matt and I am here to help!');
});
bot.on('chat', (username, message) => {
if (username === bot.username) return;
if (message === 'mine') {
bot.chat('Mining initiated!');
startMining();
} else if (message === 'farm') {
bot.chat('Farming initiated!');
startFarming();
} else {
bot.chat(message); // Echo the message back
}
});
bot.on('kicked', (reason) => {
console.log('I was kicked for', reason);
});
bot.on('error', (err) => {
console.error('An error occurred:', err);
});
bot.on('end', () => {
console.log('Bot has disconnected');
});
// Function to start mining
function startMining() {
console.log('Mining in progress...');
bot.chat('Mining logic not yet implemented.');
}
// Function to start farming
function startFarming() {
console.log('Farming in progress...');
bot.chat('Farming logic not yet implemented.');
}
Version: Minecraft forge 1.19.2
Forge: 43.4.4