8000 BUG: when collecting multipleblocks · Issue #101 · PrismarineJS/mineflayer-collectblock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
BUG: when collecting multipleblocks #101
Open
@0xrushi

Description

@0xrushi

Sometimes the bot goes halfway on a tall block and gets stuck there because no path is left.
Giving Timeout: Took to long to decide path to goal! and exiting the code.

image

A quick workaround to this to the README code is add a collectGrass() in catch.

// Load collect block
bot.loadPlugin(require('mineflayer-collectblock').plugin)

async function collectGrass() {
  // Find a nearby grass block
  const grass = bot.findBlock({
    matching: mcData.blocksByName.spruce_log.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
      collectGrass()
    }
  }
}

// On spawn, start collecting all nearby grass
bot.once('spawn', () => {
  mcData = require('minecraft-data')(bot.version)
  collectGrass()
})

But I think since collectBlock has an option to collect multiple blocks, the collectAll function here https://github.com/rushic24/mineflayer-collectblock/blob/08997f52464c219bb4ce9fd1c5eafa9f3af02482/src/CollectBlock.ts#L18
should handle that single error and continue mining other blocks in the list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0