owengage / fastnbt

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

fastanvil : allow writing maps #68

Closed nicoxxl closed 1 year ago

nicoxxl commented 1 year ago

fastanvil allow for reading maps but not writing.

It would be nice that it could.


Before edit :

RegionLoader should be able to create Regions

The RegionLoader trait is good to read maps but not to create them.

It would be nice to have a way to create empty regions, on either the RegionLoader trait or some RegionCreater extension trait.

owengage commented 1 year ago

Hi @nicoxxl, does the fastanvil::Region struct not allow what you need?

You can create a new region with that and write chunks to it. It doesn't help you create chunks though. fastanvil doesn't contain a writable chunk type (it doesn't deserialize entities for example), you'd have to make that struct yourself.

It also doesn't handle the filename and directory structure necessary.

One of the examples allows rewriting a dimension: https://github.com/owengage/fastnbt/blob/master/fastanvil/examples/anvil-palette-swap.rs