mineflayer
mineflayer copied to clipboard
My bot doesn't move when i do "collect <block>"
- [ ] The FAQ doesn't contain a resolution to my issue
Versions
- mineflayer: 3.1.1
- server: vanilla/spigot/paper Paper 311 1.18.2
- node: #.#.#
Detailed description of a problem
A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve?
What did you try yet?
Did you try any method from the API? Did you try any example? Any error from those?
Your current code
const mineflayer = require('mineflayer')
const pathfinder = require('mineflayer-pathfinder').pathfinder
const collectBlock = require('mineflayer-collectblock').plugin
const bot = mineflayer.createBot({
host: process.argv[2] || 'Test.aternos.me',
port: process.argv[3] || '64604',
username: process.argv[4] || 'MineRealm',
password: process.argv[5] || '',
logErrors: false
})
// Load pathfinder and collect block plugins
bot.loadPlugin(pathfinder)
bot.loadPlugin(collectBlock)
// Load mc data
let mcData
bot.once('spawn', () => {
mcData = require('minecraft-data')(bot.version)
})
// Listen for when a player says "collect [something]" in chat
bot.on('chat', (username, message) => {
const args = message.split(' ')
if (args[0] !== 'collect') return
// Get the correct block type
const blockType = mcData.blocksByName[args[1]]
if (!blockType) {
bot.chat("I don't know any blocks with that name.")
return
}
bot.chat('Collecting the nearest ' + blockType.name)
// Try and find that block type in the world
const block = bot.findBlock({
matching: blockType.id,
maxDistance: 64
})
if (!block) {
bot.chat("I don't see that block nearby.")
return
}
// Collect the block if we found one
bot.collectBlock.collect(block, err => {
if (err) bot.chat(err.message)
})
})
/* Some code here, replace this */
## Expected behavior
Literary go ahead and collecting the block
## Additional context
Add any other context about the problem here.

It doesn't move after i tell it to collect the block, and then after it collects when i try it again. The bot responds but never moves.
It doesn't move after i tell it to collect the block, and then after it collects when i try it again. The bot responds but never moves.
Only restarting the code works
Open an issue in collectblock repo
On Mon, May 2, 2022, 13:21 ItzVaio @.***> wrote:
- The FAQ https://github.com/PrismarineJS/mineflayer/blob/master/docs/FAQ.md doesn't contain a resolution to my issue
Versions
- mineflayer: 3.1.1
- server: vanilla/spigot/paper Paper 311 1.18.2
- node: #.#.#
Detailed description of a problem
A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? What did you try yet?
Did you try any method from the API? Did you try any example? Any error from those? Your current code
const mineflayer = require('mineflayer')const pathfinder = require('mineflayer-pathfinder').pathfinderconst collectBlock = require('mineflayer-collectblock').plugin const bot = mineflayer.createBot({ host: process.argv[2] || 'Test.aternos.me', port: process.argv[3] || '64604', username: process.argv[4] || 'MineRealm', password: process.argv[5] || '', logErrors: false}) // Load pathfinder and collect block pluginsbot.loadPlugin(pathfinder)bot.loadPlugin(collectBlock) // Load mc datalet mcDatabot.once('spawn', () => { mcData = require('minecraft-data')(bot.version)}) // Listen for when a player says "collect [something]" in chatbot.on('chat', (username, message) => { const args = message.split(' ') if (args[0] !== 'collect') return
// Get the correct block type const blockType = mcData.blocksByName[args[1]] if (!blockType) { bot.chat("I don't know any blocks with that name.") return }
bot.chat('Collecting the nearest ' + blockType.name)
// Try and find that block type in the world const block = bot.findBlock({ matching: blockType.id, maxDistance: 64 })
if (!block) { bot.chat("I don't see that block nearby.") return }
// Collect the block if we found one bot.collectBlock.collect(block, err => { if (err) bot.chat(err.message) })})
/* Some code here, replace this */
Expected behavior
Literary go ahead and collecting the block
Additional context
Add any other context about the problem here.
— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/2611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437UKUBJ2WMEYY7JJKBLVH63DDANCNFSM5U3WFXXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Okay
This is not going to be worked on 👍
