i copied the code from the repository and i cant run it, have installed all the dependencies
`// Create your bot
const mineflayer = require("mineflayer")
const bot = mineflayer.createBot({
host: 'fakeafusername.aternos.me',
username: 'Player',
version: '1.8.9'
})
let mcData
async function collectGrass() {
// Find a nearby grass block
const grass = bot.findBlock({
matching: mcData.blocksByName.grass_block.id,
maxDistance: 64
})
if (grass) {
// If we found one, collect it.
try {
await bot.collectBlock.collect(grass)
collectGrass() // Collect another grass block
} catch (err) {
console.log(err) // Handle errors, if any
}
}
}
// On spawn, start collecting all nearby grass
bot.once('spawn', () => {
mcData = require('minecraft-data')(bot.version)
collectGrass()
})`
it gives this eror:
matching: mcData.blocksByName.grass_block.id,
^
TypeError: Cannot read properties of undefined (reading 'id')
i copied the code from the repository and i cant run it, have installed all the dependencies `// Create your bot const mineflayer = require("mineflayer") const bot = mineflayer.createBot({ host: 'fakeafusername.aternos.me', username: 'Player', version: '1.8.9' }) let mcData
// Load collect block bot.loadPlugin(require('mineflayer-collectblock').plugin)
async function collectGrass() { // Find a nearby grass block const grass = bot.findBlock({ matching: mcData.blocksByName.grass_block.id, maxDistance: 64 })
if (grass) { // If we found one, collect it. try { await bot.collectBlock.collect(grass) collectGrass() // Collect another grass block } catch (err) { console.log(err) // Handle errors, if any } } }
// On spawn, start collecting all nearby grass bot.once('spawn', () => { mcData = require('minecraft-data')(bot.version) collectGrass() })`
it gives this eror: matching: mcData.blocksByName.grass_block.id, ^ TypeError: Cannot read properties of undefined (reading 'id')