This is a simple world trim script for Minecraft using the
value in chunks to determine which regions can be safely deleted.
- Python 2.7
Important: Before doing anything make sure that you have backups. You are using this program at your own risk.
Extracting the data from your world save
extract will generate a file called
world.json in your working directory containing
the accumulated inhabited time for each region in your world.
worldtrim.py extract <path to your world>
Expect the extraction to run several hours if your world size exceeds a few GB
because each chunk has to be loaded in order to access its metadata.
It can be stopped with
^C at any point and continued later.
Alternatively, the extracted data can be used to trim the part of the world that has already been processed.
Note that continuing the extraction skips the number of regions that have been extracted before
(instead of checking which regions have been extracted).
This means that regions might be skipped altogether if new regions were generated between two partial runs.
Visualizing what will be trimmed
Before trimming your world you should check whether the parameters are right for you by running
which will print the number of regions that can be deleted as well as generate a map of the world
world.png in your working directory.
In the world map each pixel represents one region colored depending on how the region is classified.
|yellow||connected to inhabited region|
Trimming the world
trim command will delete all uninhabited regions as well as the ones outside of the defined world border.
worldtrim.py trim <path to your world>
Configuring the trimming
The classification of regions can be configured using the following parameters.
They have no affect when passed to the
||regions (512m)||0,0||Center of both the spawn area and the map border.|
||regions (512m)||6000||Distance from 0,0 beyond which all regions are deleted.|
||regions (512m)||16||Distance from 0,0 within which all regions are kept.|
||ticks||18000||Time before a chunk is considered inhabited.|
||days||60||Time before a region is considered old|
||If set trimmed regions will be moved to this directory instead of being deleted.|
--old option is a safeguard to avoid deleting newly generated regions and is only applied in
A region has to be older than the specified value to be considered for deletion.
Note that the counted ticks may be less than the time that players actually spent in your world if your server had problems with lag as is often the case in vanilla Minecraft.
Finally, running the
clean command will delete all generated files from your working directory.