Skip to content
tonyhudoletnjak edited this page Jan 25, 2024 · 15 revisions

All usage examples shown here are for windows. The usage doesn't really change from Windows to Linux or Mac, so there are not linux or mac examples. The only change from platform to platform is how the program is executed, for instance:

  • Windows: from source code use regionfixer.py. Depending on your python enviroment you may need to use python regionfixer.py to run it.
  • Linux: only the source code is available, you usually will need to run it as python regionfixer.py
  • Mac: I don't own a mac but as far as I know is exactly the same as in linux, you will need to run it as python regionfixer.py

Note: Please note that in Windows if your world directory has spaces or special characters you have to use quotation marks as in this example:

python regionfixer.py "c:\Mincraft servers\1º server with strangely long name#3"

Command line interface

First, open a prompt (a MS-DOS window). The easiest why is probably to run cmd.exe in the run menu (use "windows key + r" as shortcut). If you are running windows 8/10 you only have to press the windows key and then write cmd and press enter.

Once in the prompt navigate to the folder where you have decompressed region fixer. If you don't know hot to navigate in there, please, try to watch a tutorial on how to change directories and execute programs from the command prompt. Youtube and Google are your friends!

If you are unable to run Region Fixer refer to Troubleshooting.

Once you got it running you can read the program help using python regionfixer.py --help. That will print a ton of options and stuff. Some commonly used options are:

  • --processes or -p that will set the number of processes to use, this will speed up the scan a lot (if you have a few cores to spare).
  • --log myfilename.txt or -l myfilename.txt that will save a log file with in detail results.

Now lets see some usage examples in different cases:

Scanning single region files or arbitrary region sets.

If you know where the problem is you can scan a single region file instead of scanning the whole world and save precious time. You can also scan a few region files from different locations. Example:

NOTE: The first line is the command used to run region fixer. The first character in this line is the prompt symbol and is not part of the command.

    > python regionfixer.py c:\worlds\test\region\r.1.1.mca

    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ############## Scanning separate region files ##############
    ############################################################

    Scanning:  1 /  1 100% [#######################################] Time: 00:00:01

    Chunk problems:
    No problems found.


    Region files problems:
    No problems found.

You can also:

    > python regionfixer.py -p 4 c:\worlds\test2\region\*.mca

    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ############## Scanning separate region files ##############
    ############################################################

    Scanning: 18 / 18 100% [#######################################] Time: 00:00:01

    Chunk problems:
    No problems found.


    Region files problems:
    No problems found.

Scanning a Minecraft world or a set of Minecraft worlds.

The typical usage of Region-Fixer will be to scan a whole world. To do that only point it to the world path. For exampe:

    $ regionfixer.py -p 4  c:\worlds\broken-world

    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ###############  Scanning world: Broken world ##############
    ############################################################

    World info:
    There are 144 region files, 435 player files and 507 data files in the world dir
    ectory.

    -------------------- Checking level.dat --------------------
    'level.dat' is readable

    ---------------- Scanning UUID player files ----------------
    Scanning: 13 / 13 100% [#######################################] Time: 00:00:00

    ------------- Scanning old format player files -------------
    Scanning: 422 / 422 100% [#####################################] Time: 00:00:00

    ---------- Scanning structures and map data files ----------
    Scanning: 507 / 507 100% [#####################################] Time: 00:00:04

    ------------------ Scanning region files -------------------
    Scanning: 144 / 144 100% [#####################################] Time: 00:00:23


    ############################################################
    ############### Scan results for: Broken world #############
    ############################################################


    Unreadable player files:
    cosarota.dat

    Unreadable data files:
    No problems found.

    Chunk problems:
    --------------------------------------------------------------------
    | Problem | Corrupted  Wrong l.  Entities  Shared o.  Total chunks |
    --------------------------------------------------------------------
    | Counts  |    644        1         1          3         21808     |
    --------------------------------------------------------------------

    Region problems:
    --------------------------------------------------
    | Problem | Too small  Unreadable  Total regions |
    --------------------------------------------------
    | Counts  |    26          0            144      |
    --------------------------------------------------

You can also point to a few worlds and Region-Fixer will scan them all.

Deleting broken stuff.

You can use the --delete-* options to delete broken chunks or broken region files or even entities when there are too many in a chunk. In the next example we see the results of using --delete-corrupted and we use four processes to scan the world (we add the option -p 4):

    $ python regionfixer.py -p 4 --delete-corrupted "c:\worlds\broken-world"
    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ###############  Scanning world: Broken world  #############
    ############################################################

    World info:
    There are 144 region files, 435 player files and 507 data files in the world dir
    ectory.

    -------------------- Checking level.dat --------------------
    'level.dat' is readable

    ---------------- Scanning UUID player files ----------------
    Scanning: 13 / 13 100% [#######################################] Time: 00:00:00

    ------------- Scanning old format player files -------------
    Scanning: 422 / 422 100% [#####################################] Time: 00:00:00

    ---------- Scanning structures and map data files ----------
    Scanning: 507 / 507 100% [#####################################] Time: 00:00:04

    ------------------ Scanning region files -------------------
    Scanning: 144 / 144 100% [#####################################] Time: 00:00:23


    ############################################################
    ############### Scan results for: Broken world  ############
    ############################################################


    Unreadable player files:
    cosarota.dat

    Unreadable data files:
    No problems found.

    Chunk problems:
    --------------------------------------------------------------------
    | Problem | Corrupted  Wrong l.  Entities  Shared o.  Total chunks |
    --------------------------------------------------------------------
    | Counts  |    644        1         1          3         21808     |
    --------------------------------------------------------------------

    Region problems:
    --------------------------------------------------
    | Problem | Too small  Unreadable  Total regions |
    --------------------------------------------------
    | Counts  |    26          0            144      |
    --------------------------------------------------



    ########## Deleting chunks with status: Corrupted ##########
     Deleting chunks in region set "region":
    Removed 644 chunks in this regionset.

     Deleting chunks in region set "DIM-1":
    Removed 0 chunks in this regionset.


    Deleted 644 chunks with status: Corrupted

Replacing chunks or region files.

If you have backups of you minecraft world you can use them to replace all the broken chunks and region files. For that use the options --replace-* in combination with the option --backup. The option --backup wants as argument paths to Minecraft worlds that are backups of your world. For example, this command will scan the world using 4 processes and then replace any wrong-located chunks found using the backups in one of the two backup directories provided (you can add as many backups directories as you want, writing them comma separated):

    > python regionfixer.py -p 4 --replace-wrong --backups 
    c:\mine-backups\2014-06,c:\mine-backups\2014-05 c:\worlds\broken-world

    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ###############  Scanning world: Broken world ##############
    ############################################################

    World info:
    There are 144 region files, 435 player files and 507 data files in the world dir
    ectory.

    -------------------- Checking level.dat --------------------
    'level.dat' is readable

    ---------------- Scanning UUID player files ----------------
    Scanning: 13 / 13 100% [#######################################] Time: 00:00:00

    ------------- Scanning old format player files -------------
    Scanning: 422 / 422 100% [#####################################] Time: 00:00:00

    ---------- Scanning structures and map data files ----------
    Scanning: 507 / 507 100% [#####################################] Time: 00:00:04

    ------------------ Scanning region files -------------------
    Scanning: 144 / 144 100% [#####################################] Time: 00:00:22


    ############################################################
    ############### Scan results for: Broken world #############
    ############################################################


    Unreadable player files:
    cosarota.dat

    Unreadable data files:
    No problems found.

    Chunk problems:
    --------------------------------------------------------------------
    | Problem | Corrupted  Wrong l.  Entities  Shared o.  Total chunks |
    --------------------------------------------------------------------
    | Counts  |     0         1         1          3         21164     |
    --------------------------------------------------------------------

    Region problems:
    --------------------------------------------------
    | Problem | Too small  Unreadable  Total regions |
    --------------------------------------------------
    | Counts  |    26          0            144      |
    --------------------------------------------------

    ####### Replacing chunks with status: Wrong located ########

    ------ New chunk to replace. Coords: x = 18; z = -63 -------
    Backup region file found in:
      c:\mine-backups\2014-06/region/r.0.-2.mca
    Replacing...
    Chunk replaced using backup dir: c:\mine-backups\2014-06

    1 replaced of a total of 1 chunks with status: Wrong located

There are options to replace all the chunks problems and all the region problems.

Handling too many entities problems.

Sometimes, while playing Minecraft, you ask to yourself "What would happend if I fill a whole chunk with TNT and I light it?". Well It's pretty awesome but after that your world probably won't work anymore because thousands of entities are moving in every direction and the server is dying trying to move all of them.

When this happens you can use the options --entity-limit and --delete-entities to remove all the entities in any chunk that has more entities than the number given to --entity-limit (150 entities by default).

In the example we scan the world using 4 processes and we delete all the entities in any chunk that has more than 100 entities:

    > regionfixer.py -p 4 --delete-entities --entity-limit 100
    c:\worlds\broken-world

    Welcome to Region Fixer!
    (version: 0.2.0)

    ############################################################
    ###############  Scanning world: Broken world ##############
    ############################################################

    World info:
    There are 144 region files, 435 player files and 507 data files in the world dir
    ectory.

    -------------------- Checking level.dat --------------------
    'level.dat' is readable

    ---------------- Scanning UUID player files ----------------
    Scanning: 13 / 13 100% [#######################################] Time: 00:00:00

    ------------- Scanning old format player files -------------
    Scanning: 422 / 422 100% [#####################################] Time: 00:00:00

    ---------- Scanning structures and map data files ----------
    Scanning: 507 / 507 100% [#####################################] Time: 00:00:04

    ------------------ Scanning region files -------------------
    Deleted 46944 entities in chunk (13,6) of the region file: r.0.-2.mca  00:00:02
    Scanning: 144 / 144 100% [#####################################] Time: 00:00:39


    ############################################################
    ############### Scan results for: Broken world #############
    ############################################################


    Unreadable player files:
    cosarota.dat

    Unreadable data files:
    No problems found.

    Chunk problems:
    --------------------------------------------------------------------
    | Problem | Corrupted  Wrong l.  Entities  Shared o.  Total chunks |
    --------------------------------------------------------------------
    | Counts  |     0         0         0          3         21164     |
    --------------------------------------------------------------------

    Region problems:
    --------------------------------------------------
    | Problem | Too small  Unreadable  Total regions |
    --------------------------------------------------
    | Counts  |    26          0            144      |
    --------------------------------------------------


    No chunks to delete with status: Too many entities

Region-Fixer will delete entities while scanning (that's why it says there are no chunks to delete at the end, it has deleted the entities in the middle of the scan), so it doesn't have to load those chunks twice.

Please note, if you have a chunk with a lot of entities, you need to load that chunk in RAM in order to delete them. Sometimes you will need GBs of RAM and a good amount of time to do so, please, be patient.

Also, this method will delete all the entities in those chunks, at the moment of writing this Entities stored in chunks are:

  • mobs
  • projectiles (arrows, snowballs...)
  • primed TNT
  • ender crystal
  • paintings
  • items on the ground (don't worry chests are safe)
  • vehicles (boats and minecarts)
  • dynamic tiles (falling sand, primed TNT)

Verbose

If you scan a world using the --verbose option, RegionFixer will print a line for each file scanned. The line will look, for data files, something like this:

Scanned raids.dat    (File: "raids.dat"; status: OK)............ 1/1

An I think it's pretty self explanatory. For region files:

Scanned r.-3.-5.mca  (c:0, w:0, tme:0, so:0, mt:0, t:930)....... 76/149

Those codes mean:

  • c: number of corrupted chunks
  • w: number of wrong located chunks
  • tme: number of chunks with too many entities
  • so: number of chunks sharing offset with other chunks
  • mt: number of chunks with the Entities TAG missing
  • t: total of chunks in that region file

To know more about these problems see Chunk and region problems.

Interactive mode.

This feature is deprecated

This mode allows you to keep the scan information while you decide what to do with your world. It's very useful if you don't know what's wrong in your world and a full scan takes a lot of time. To use this mode add the option --interactive or -i. Once in interactive mode you can use help to see a list of commands.

In this example we use interactive mode to remove chunks sharing offset. First we scan the world:

    $ python regionfixer.py -p 4 --interactive ~/cosas\ minecraft/Mundos\ corruptos\ \(anv
    il\)/Otros/2014.06.17\ #\ Crafted\ with\ all\ the\ possible\ chunk\ problems/

    Welcome to Region Fixer!
    (version: 0.2.0)
    Minecraft Region-Fixer interactive mode.
    (Use tab to autocomplete. Type help for a list of commands.)

    #-> scan
    World info:
    There are 144 region files, 435 player files and 507 data files in the world dir
    ectory.

    -------------------- Checking level.dat --------------------
    'level.dat' is readable

    ---------------- Scanning UUID player files ----------------
    Scanning: 13 / 13 100% [#######################################] Time: 00:00:00

    ------------- Scanning old format player files -------------
    Scanning: 422 / 422 100% [#####################################] Time: 00:00:00

    ---------- Scanning structures and map data files ----------
    Scanning: 507 / 507 100% [#####################################] Time: 00:00:04

    ------------------ Scanning region files -------------------
    Scanning: 144 / 144 100% [#####################################] Time: 00:00:08

Then we get a summary of what is going wrong with it:

    #-> summary

    Unreadable player files:
    cosarota.dat

    Unreadable data files:
    No problems found.

    Chunk problems:
    --------------------------------------------------------------------
    | Problem | Corrupted  Wrong l.  Entities  Shared o.  Total chunks |
    --------------------------------------------------------------------
    | Counts  |     0         0         0          3         21164     |
    --------------------------------------------------------------------

    Region problems:
    --------------------------------------------------
    | Problem | Too small  Unreadable  Total regions |
    --------------------------------------------------
    | Counts  |    26          0            144      |
    --------------------------------------------------

Now we just want to know what can we do with this interactive mode so we type:

    #-> help

    Documented commands (type help <topic>):
    ========================================
    EOF            current_workload  remove_chunks    replace_regions
    count_all      exit              remove_entities  scan
    count_chunks   help              remove_regions   set
    count_regions  quit              replace_chunks   summary

We really want to delete those sharing offset chunks, so:

    #-> remove_chunks sharing
     Deleting chunks in region set "region":
    Removed 3 chunks in this regionset.

     Deleting chunks in region set "DIM-1":
    Removed 0 chunks in this regionset.

    Removed 3 chunks with status 'Sharing offset'.

And its done! Now we can type:

    #-> quit