A small collection of tools to deal with Minecraft's Anvil chunk storage system while out of the game. Might be useful for server operators or people who do not want to wait on Minecraft's "world optimization..."
- Strip cached world data (similar to the "Optimize World" feature in vanilla)
- Compress region files for long-term archival (300% to 500% improvement in compression ratio versus compressing the region directory verbatim)
Use the --help argument for usage information.
The pack command produces an uncompressed tarball in a very simple format, consisting of a directory for each region file, with
a file for every chunk within that region. Region directories use the absolute coordinates of the region, and each chunk uses
relative coordinates to that region.
While this archive format may seem crude, it was chosen to be as simple as possible for other tools to work with. Unlike a ZIP archive, tarballs lend easily to solid compression, which improves the compression ratio greatly.
Compression is not a concern of this tool, and you should pipe the tarball generated by pack into a compressor of your choice
(such as plzip or zstd) and write it out to disk. For an example of how to do this with the pack and unpack commands, see
the following.
anvil-tools pack --input-dir <PATH> | plzip -9 > <ARCHIVE>
plzip -d -c <ARCHIVE> | anvil-tools unpack --output-dir <PATH>
Minecraft's built-in tools have a few issues that occasionally bite me when debugging issues. In no particular order, the vanilla tools...
- ... are very slow, taking multiple hours on modest worlds.
- ... often crash due to concurrency issues and heap exhaustion from unbounded queues.
- ... only support in-place modification, making the previous point more painful.
- ... require you to have either the Minecraft client or server running.
There also doesn't seem to be any existing tool for compressing Minecraft worlds in an efficient manner, with most backup plugins simply compressing the (already compressed) region files naively. This tool unpacks the region files into a tarball format which is more suitable for compression.