bedrock-protocol
bedrock-protocol copied to clipboard
Viewer Example doesn't work
Hi,
I tried the viewer example, but I couldn't get it to work! I am a webdev and programmer so I know how to solve stuff, but I just wasn't able to get it to work. It kept giving notAuthenticated error at my relay (which I had to run myself, since the viewer didn't do it).
I can share the changes I made so far which got me there. But yeah I was hoping that this thing would work...
- Miniontoby
So I got it somewhat working...
But I get disconnected everytime after the join event somewhere...
Using the debugger I found this error which I think is causing the disconnect:
minecraft-protocol while sending to +17ms RakNativeClient {_events: {…}, _eventsCount: 0, _maxListeners: undefined, connected: true, onConnected: ƒ, …} Error: Failed to send: -5
at Client.send (C:\Users\Miniontoby\Documents\bedrock-protocol\node_modules\raknet-native\lib\RakNet.js:57:13)
at RakNativeClient.sendReliable (C:\Users\Miniontoby\Documents\bedrock-protocol\src\rak.js:77:24)
at Client.sendMCPE (C:\Users\Miniontoby\Documents\bedrock-protocol\src\connection.js:139:23)
at Cipheriv.onEncryptedPacket (C:\Users\Miniontoby\Documents\bedrock-protocol\src\connection.js:149:10)
at Cipheriv.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Cipheriv._transform (node:internal/crypto/cipher:154:8)
at Transform._write (node:internal/streams/transform:184:23)
Maybe you guys can help me solve this error...
- Miniontoby
Hey,
Oke so I now fixed that, but I now got a different error thing and after that it appeared the debugger crashed and the electron stopped doing stuff

- Miniontoby
Hi,
So to come back to that image I showed: it seems to have something to do with cc.networkDecodeNoCache inside the BotProvider.handleChunk function.
And then I think with the packet.payload. Here is the is full packet object
Also I would really appreciate any response...
EDIT: I fixed that now by setting the version number of a certain file back to 1.16.1
But now I got this error at the chunks:
Uncaught (in promise) TypeError: cc.serialize is not a function
at C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\client\BotProvider.js:38:24
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
- Miniontoby
This is not an actively maintained example and may be removed in the future. You can use it as a reference but yes it does not currently work. Mineflayer support would permit prismarine-web-client to work, which #116 tracks.
This is not an actively maintained example and may be removed in the future. You can use it as a reference but yes it does not currently work. Mineflayer support would permit prismarine-web-client to work, which #116 tracks.
But yeah that's why I want to make it working again...
Do you have any clue how to replace/fix the cc.serialize function?
EDIT: I got the chunk correct, but now I got different error, need to copy it and upload it here soon
Here are my errors that I encounter now. I would love that you can still try to help me fix this even though it is no longer maintainced.
Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Worker': other => versions[other] ? v1 >= versions[other].dataVersion : raise(other) could not be cloned.
at WorldRenderer.addColumn (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-viewer\viewer\lib\worldrenderer.js:87:14)
at Viewer.addColumn (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-viewer\viewer\lib\viewer.js:42:16)
at ClientProvider.<anonymous> (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-viewer\viewer\lib\viewer.js:76:12)
at ClientProvider.emit (node:events:527:28)
at C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\client\BotProvider.js:41:32
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
And also I got this:
Uncaught (in promise) TypeError: this.buffer.slice is not a function
at ByteStream.readBuffer (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-chunk\src\bedrock\common\Stream.js:272:31)
at ChunkColumnWrapped.networkDecodeNoCache (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-chunk\src\bedrock\1.3\ChunkColumn.js:193:33)
at ChunkColumnWrapped.networkDecodeNoCache (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\node_modules\prismarine-chunk\src\bedrock\1.18\ChunkColumn.js:149:13)
at ClientProvider.handleChunk (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\client\BotProvider.js:35:8)
at Client.<anonymous> (C:\Users\Miniontoby\Documents\bedrock-protocol\examples\viewer\client\ClientProvider.js:84:12)
at Client.emit (node:events:527:28)
at Client.readPacket (C:\Users\Miniontoby\Documents\bedrock-protocol\src\client.js:225:10)
at Client.onDecryptedPacket (C:\Users\Miniontoby\Documents\bedrock-protocol\src\connection.js:156:12)
at Decipheriv.verify (C:\Users\Miniontoby\Documents\bedrock-protocol\src\transforms\encryption.js:74:12)
at Decipheriv.emit (node:events:527:28)
EDIT: The first error just has to do with the prismarine viewer, no longer with this viewer example!
This example has since been removed. There’s some work in bedrock provider now to update it for 1.18.10 and 1.18.30. Beyond that, updating prismarine viewer to support bedrock edition is something that should move forward in that repo not here. Feel free to open a PR there for any work on that.