TypeError: Cannot set properties of undefined (setting 'heldItem')
at EventEmitter.updateHeldItem (node_modules\mineflayer\lib\plugins\inventory.js:366:25)
at EventEmitter.setQuickBarSlot (node_modules\mineflayer\lib\plugins\simple_inventory.js:59:9)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
Versions
node_modules\mineflayer\lib\plugins\inventory.js:366 bot.entity.heldItem = bot.heldItem ^
TypeError: Cannot set properties of undefined (setting 'heldItem') at EventEmitter.updateHeldItem (node_modules\mineflayer\lib\plugins\inventory.js:366:25) at EventEmitter.setQuickBarSlot (node_modules\mineflayer\lib\plugins\simple_inventory.js:59:9) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)
Your current code
Expected behavior
It is supposed to set quick bar slot to 4 if the bot has a player_head in his inventory, else it will set it to 0
Additional context
usually the code works but its giving that error randomly like every 15-20 minutes