imharvol / mineflayer-web-inventory Goto Github PK
View Code? Open in Web Editor NEWWeb based viewer for your mineflayer bot's inventory
License: MIT License
Web based viewer for your mineflayer bot's inventory
License: MIT License
As can be seen in this CI run https://github.com/imharvol/mineflayer-web-inventory/runs/6212744006?check_suite_focus=true#step:6:91, a PartialReadError: Read error for undefined : undefined
is thrown.
PartialReadError: Read error for undefined : undefined
at new ExtendableError (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/utils.js:63:13)
at new PartialReadError (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/utils.js:70:5)
at Object.readVarInt [as varint] (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/datatypes/utils.js:69:45)
at eval (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:631:67)
at eval (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:641:13)
at eval (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:768:11)
at Object.packet_declare_commands (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:773:9)
at eval (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:2162:72)
at packet (eval at compile (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:258:12), <anonymous>:2253:9)
at CompiledProtodef.read (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:70:12)
at e.message (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:111:49)
at tryCatch (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/utils.js:50:16)
at CompiledProtodef.parsePacketBuffer (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/compiler.js:111:29)
at FullPacketParser.parsePacketBuffer (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/serializer.js:68:23)
at FullPacketParser._transform (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/protodef/src/serializer.js:74:21)
at FullPacketParser.Transform._read (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_transform.js:177:10)
at FullPacketParser.Transform._write (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_transform.js:164:83)
at doWrite (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at FullPacketParser.Writable.write (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_writable.js:307:11)
at Decompressor.ondata (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_readable.js:681:20)
at Decompressor.emit (events.js:400:28)
at addChunk (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_readable.js:298:12)
at readableAddChunk (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_readable.js:280:11)
at Decompressor.Readable.push (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_readable.js:241:10)
at Decompressor.Transform.push (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/readable-stream/lib/_stream_transform.js:139:32)
at Unzip.cb (/home/runner/work/mineflayer-web-inventory/mineflayer-web-inventory/node_modules/minecraft-protocol/src/transforms/compression.js:69:14)
at Unzip.zlibBufferOnEnd (zlib.js:158:10)
at Unzip.emit (events.js:400:28)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Only happens with Minecraft 1.18.2 and doesn't appear to stop mineflayer nor mineflayer-web-inventory from working
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"
When having mineflayer-web-inventory open in your browser, trying to deposit items to chests fails.
I'd recommend fixing this as new mineflayer developers (like myself) will doubt their mental sanity after failing to copy an example multiple times :D
Code to reproduce:
let chest = bot.blockAt(new Vec3(96, 80, 130)) bot.openChest(chest).then((inventory) => { inventory.deposit(621, null, 64).then(() => inventory.close()) })
Stacktrace:
at clickDest (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:223:51)
at transferOne (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:220:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async transfer (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:203:5)
at async C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:292:7
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:247:11)
at processTicksAndRejections (internal/process/task_queues.js:94:32)
(node:1756) TypeError: Cannot read property 'type' of null
at clickDest (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:223:51)
at transferOne (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:220:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async transfer (C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:203:5)
at async C:\Users\Constantin Schreiber\WebstormProjects\minecraft_storage_bot\node_modules\mineflayer\lib\plugins\inventory.js:292:7
(node:1756) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
at emitDeprecationWarning (internal/process/promises.js:180:11)
at processPromiseRejections (internal/process/promises.js:249:13)
at processTicksAndRejections (internal/process/task_queues.js:94:32)
Part of the current code breaks due to PrismarineJS/mineflayer#1640
Will work on it once the new windows API has been tested for a few days
so I can link it from mineflayer in https://github.com/PrismarineJS/mineflayer#more-examples
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)
It would be useful to be able to click and move the items to reorganize the bot inventory, craft or even drop the items. This shouldn't be too hard to implement with mineflayer.
Git clone procedure is not great
Can multiple bot instances be supported? like using the same port 80 and using different web paths to view them
Methods:
bot.webInventory.start()
bot.webInventory.stop()
maybe not return a Promise because they callbackified.
Need to update docs to use like this:
bot.webInventory.start(() => {})
bot.webInventory.stop(() => {})
I advise to simply copy/paste this https://github.com/PrismarineJS/prismarine-world/blob/master/.github/workflows/nodejs.yml
Crafting table, anvils, custom windows, etc...
Could use the data from https://github.com/PrismarineJS/prismarine-windows
Add a visual indicator for tool durability like the vanilla durability indicator.
there https://github.com/PrismarineJS/mineflayer#third-party-plugins
(cool plugin BTW, thanks for making it !)
In version 1.12.2 the only wool item color displayed in the inventory gui is white wool even if other colors are in the inventory.
Due to the path option we expose we can't use absolute paths to get the static files, as we want the static directory (the one that holds js, css, html and the inventory images) to be under the path specified by the user. This forces us to make some ugly things:
mineflayer-web-inventory/public/index.html
Lines 8 to 11 in bcac649
I haven't been able to recreate, but apparently users can have problems with this: https://discord.com/channels/413438066984747026/413438150594265099/872460404956201020
Users with this problem can use the remove-path branch and thus without relative urls npm i https://github.com/imharvol/mineflayer-web-inventory.git#remove-path
We could also host the static files on /public, but that may cause interference with the user's public files
An solution would be to use lodash _.throttle() function
Hello!
Is very great this plugin,
I'm trying to get an option if the plugin is already running and which port is listening, it is possible to add?
web-inventory doesnt works on python
Requires in my code:
mineflayer = require('mineflayer')
pathfinder = require('mineflayer-pathfinder')
movements = require('mineflayer-pathfinder').Movements
GoalNear = require('mineflayer-pathfinder').goals
inventoryViewer = require('mineflayer-web-inventory')
pvp = require('mineflayer-pvp').plugin
I think the tripwire hook has the texture of an oak plank,could you change it?
Please add a option to hide the Item data, like the text under the list of items
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.