PrismarineJS / minecraft-chunk-dumper

Dumps chunks for any minecraft version
9 stars 7 forks source link

How do I parse .dump files? #27

Open TheOnlyWayUp opened 2 years ago

TheOnlyWayUp commented 2 years ago

My goal is to convert a .dump file to an array of block IDs, going from the lowest Y to the height limit. I'm doing this in Python and I'm not sure how the file is encoded, nor am I sure how I can decode it, the amount of bytes is much more than the height limit too, I've also gone through Prismarine-Chunk but I didn't understand what it did, if I can't parse it into block IDs, is there a way I can generate a top view image from it? Thanks!

TL:DR - How do I parse .dump files into an array of block IDs?

rom1504 commented 2 years ago

see https://wiki.vg/Chunk_Format https://github.com/PrismarineJS/prismarine-chunk/ some other implementations there https://wiki.vg/Chunk_Format#Full_implementations including a python one https://github.com/barneygale/quarry/blob/master/quarry/types/chunk.py

you can also use https://github.com/extremeheat/JSPyBridge also with prismarine-chunk to stay in python while having all versions support

chunks in minecraft are the most complicated part of the serialization. There is no easy way out of this Either you need to take the time to understand it, either you use an existing lib

TheOnlyWayUp commented 2 years ago

Interesting, thank you so much for the fast response and the useful resources! I'm going over them right now, I'd like to know though, is there a way I can directly integrate these .dump files into the Prismarine Viewer?

rom1504 commented 2 years ago

I guess you could read them with pchunk, put them in a pworld then use something like https://github.com/PrismarineJS/prismarine-world/blob/master/examples/viewer/index.js

what is your goal ?

I figure https://github.com/PrismarineJS/mineflayer/blob/master/examples/anvil_saver/saver.js + https://github.com/PrismarineJS/prismarine-world/blob/master/examples/viewer/index.js might be closer to what you want (saving anvil with mineflayer then viewing with pviewer)

TheOnlyWayUp commented 2 years ago

My goal is to join a server, download some chunks and display that on my website just as a proof of concept, does Mineflayer not have a limited range of versions? And, it's also slightly complicated. I'll definitely look into using Mineflayer. Thanks for your quick responses, I'd like to know, is there a better way to ask you questions?

rom1504 commented 2 years ago

does Mineflayer not have a limited range of versions

yes 1.8 to 1.17

And, it's also slightly complicated. I'll definitely look into using Mineflayer

https://github.com/PrismarineJS/mineflayer/blob/master/examples/anvil_saver/saver.js if you run that it gets you a world save of that server

is there a better way to ask you questions?

you can join our discord https://discord.gg/GsEFRM8