Skip to content

The bot can't open the chest 1.21.8 #3769

@MayorLeon20

Description

@MayorLeon20
  • [+] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.33.0
  • server: paper 1.21.8
  • node: 24.6.0

Detailed description of a problem

I want the bot to open a chest on 1.21.8, but it won't open it. It keeps timing out.
The bot is standing right next to the chest.

What did you try yet?

Did you try any method from the API? yes
Did you try any example? Any error from those? yes, the same err

Your current code

const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
    username: '',
    auth: 'offline',
    version: '1.21.8',
    hideErrors: false,
    host: 'localhost'
})

bot.on('windowOpen', window => {
    console.log('window open event fired')
})

bot.on('spawn', async () => {
    await bot.waitForChunksToLoad().then(async () => {
        const chestToOpen = bot.findBlock({
            matching: (block) => block.name === 'chest',
            maxDistance: 50
        });
        
        console.log(chestToOpen)
        
        const chest = await bot.openContainer(chestToOpen)
    });
})

Console

Block {
  type: 188,
  metadata: 13,
  light: 2,
  skyLight: 15,
  biome: {
    color: 0,
    height: null,
    name: '',
    rainfall: 0,
    temperature: 0,
    id: 40
  },
  position: Vec3 { x: 3, y: -59, z: 5 },
  stateId: 3031,
  computedStates: {},
  name: 'chest',
  hardness: 2.5,
  displayName: 'Chest',
  shapes: [ [ 0.0625, 0, 0.0625, 0.9375, 0.875, 0.9375 ] ],
  boundingBox: 'block',
  transparent: false,
  diggable: true,
  material: 'mineable/axe',
  harvestTools: undefined,
  drops: [ 319 ],
  _properties: { waterlogged: false, type: 'single', facing: 'west' },
  isWaterlogged: false,
  entity: undefined,
  painting: undefined
}
Error: Event windowOpen did not fire within timeout of 20000ms
    at onceWithCleanup (C:\Users\petru\WebstormProjects\yagodki-mineflayer\node_modules\mineflayer\lib\promise_utils.js:62:26)
    at once (C:\Users\petru\WebstormProjects\yagodki-mineflayer\node_modules\mineflayer\lib\promise_utils.js:76:10)
    at EventEmitter.openBlock (C:\Users\petru\WebstormProjects\yagodki-mineflayer\node_modules\mineflayer\lib\plugins\inventory.js:383:28)
    at EventEmitter.openContainer (C:\Users\petru\WebstormProjects\yagodki-mineflayer\node_modules\mineflayer\lib\plugins\chest.js:19:25)
    at handleTransferTask (C:\Users\petru\WebstormProjects\yagodki-mineflayer\bot\plugins\tasks.js:136:57)
    at async C:\Users\petru\WebstormProjects\yagodki-mineflayer\bot\plugins\tasks.js:251:33
    at async EventEmitter.<anonymous> (C:\Users\petru\WebstormProjects\yagodki-mineflayer\bot\plugins\tasks.js:235:9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions