owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
186 stars 34 forks source link

`region-dump` now requires a `chunks` directory for output instead of `stdout`? #41

Closed rjp closed 2 years ago

rjp commented 2 years ago

I used to use region-dump to output a region to stdout (for various analysis purposes) but that seems to have changed (somewhere around 2021-07-05?) and it now dumps the region into a bunch of files in a chunks folder?

Any chance we can have the old stdout behaviour back? I can't revert to the old version because my worlds are now 1.18 but the new chunks folder approach doesn't really work for analysis.

owengage commented 2 years ago

Hey there, this can definitely be done. The region-dump executable is pretty simple.

Was the behaviour you wanted just dumping out the chunks one after the other in Rust's debug format? Is there a better format you'd rather it spit out to? Converting it to json should be possible for example.

rjp commented 2 years ago

Yeah, just all the chunks in the region like it used to do.

JSON would be perfect - I did have a stab at converting the Rust debug format into JSON but my Rust is non-existent and trying to convert it post-hoc turned into a nightmare.

Thanks!

owengage commented 2 years ago

Latest fasnbt-tools should have you covered:

region-dump <file> # all chunks to stdout in Rust debug format
region-dump -f json <file> # all chunks to stdout in JSON, one line per chunk.
region-dump -f json -o chunks <file> # chunk per file in JSON
region-dump -f nbt -o chunks <file> # chunk per file in original NBT

You can also specify json-pretty and rust-pretty to get pretty-print versions. The exact format might have changed since you last tried since I had to change how the deserialiser works prior to 1.0.

Let me know if this works or not!