imharvol / mineflayer-web-inventory

Web based viewer for your mineflayer bot's inventory
MIT License
79 stars 19 forks source link

Error when opening the web gui #30

Closed IceTank closed 2 years ago

IceTank commented 2 years ago

I got this error when I opened the web gui once. I think the bot had iron ingots and sheers in its inventory. Maybe there is a validations check missing somewhere?

/home/auditman/NodeJS/mineflayer-auto-shepherd/node_modules/mineflayer-web-inventory/utils.js:53
      rawMcData.legacy.pc.items[item.type + ':' + item.metadata].substr('minecraft:'.length)
                                                                 ^
TypeError: Cannot read properties of undefined (reading 'substr')
    at addTexture (/home/auditman/NodeJS/mineflayer-auto-shepherd/node_modules/mineflayer-web-inventory/utils.js:53:66)
    at emitWindow (/home/auditman/NodeJS/mineflayer-auto-shepherd/node_modules/mineflayer-web-inventory/index.js:96:40)
    at Namespace.<anonymous> (/home/auditman/NodeJS/mineflayer-auto-shepherd/node_modules/mineflayer-web-inventory/index.js:103:5)
    at Namespace.emit (node:events:526:28)
    at /home/auditman/NodeJS/mineflayer-auto-shepherd/node_modules/socket.io/dist/namespace.js:135:27
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
imharvol commented 2 years ago

I gave some sheers and iron ingots to the bot in 1.12.2 and it didn't crash, so it probably was something else. In any case, in 1.8.1 (already published) it should just fallback to https://github.com/imharvol/mineflayer-web-inventory/blob/d07a7c9f37af95cfbc1b132f3cecd1b8816b0242/utils.js#L76-L78