Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot crashes if it has items when no Minecraft version in bot is specified #34

Open
V1nc3VD opened this issue Jun 20, 2022 · 2 comments
Open

Comments

@V1nc3VD
Copy link

V1nc3VD commented Jun 20, 2022

Web Inventory only works when the bot has no items. If it has an item it crashes.
I tried it on Minecraft 1.18.2

Error message

mineflayer-web-inventory error. trying to continue
TypeError: mcData.version.<= is not a function
    at addItemData (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\utils.js:47:29)
    at emitWindow (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\index.js:96:40)
    at Namespace.<anonymous> (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\index.js:103:5)
    at Namespace.emit (node:events:527:28)
    at C:\projects\discord-minecraft-bot\node_modules\socket.io\dist\namespace.js:135:27
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\utils.js:82
  if ((itemMaxDurability = mcData.itemsByName[item.name].maxDurability) && item.durabilityUsed != null) {
                                             ^

TypeError: Cannot read properties of undefined (reading 'azure_bluet')
    at addItemData (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\utils.js:82:46)
    at emitWindow (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\index.js:96:40)
    at Namespace.<anonymous> (C:\projects\discord-minecraft-bot\node_modules\mineflayer-web-inventory\index.js:103:5)
    at Namespace.emit (node:events:527:28)
    at C:\projects\discord-minecraft-bot\node_modules\socket.io\dist\namespace.js:135:27
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Mineflayer versions:

    "minecraft-assets": "^1.9.0",
    "minecraft-data": "^3.5.0",
    "mineflayer": "^4.3.0",
    "mineflayer-armor-manager": "^1.4.2",
    "mineflayer-pathfinder": "^2.1.1",
    "mineflayer-pvp": "^1.2.1",
    "mineflayer-web-inventory": "^1.8.2"
@V1nc3VD V1nc3VD changed the title bot crashes when it has items. bot crashes when it has items Jun 20, 2022
@imharvol
Copy link
Owner

imharvol commented Jun 20, 2022

Are you specifying the minecraft version when creating the bot?

const bot = mineflayer.createBot({
  // ...
  version: '1.18.2' // <---------------------- This
})

If not, try to do that and check if it works.

imharvol added a commit that referenced this issue Jun 20, 2022
- Closes #33: Let's just use promises
- Related to #34: Just small fixes so the bot doesn't hard crash
@V1nc3VD
Copy link
Author

V1nc3VD commented Jun 22, 2022

Are you specifying the minecraft version when creating the bot?

const bot = mineflayer.createBot({
  // ...
  version: '1.18.2' // <---------------------- This
})

If not, try to do that and check if it works.

Thank you, I tried that and it solved it.

@V1nc3VD V1nc3VD changed the title bot crashes when it has items bot crashes if it has items when no Minecraft version in bot is specified Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants