HomeJavaModsWorld Utils
World Utils

Description

World Utils adds several commands to manipulate or fix Minecraft worlds.

Some of the commands include:

A lot more commands are planned and will be implemented when I have free time to work on this mod.

There is also the Chunk Wand item (disabled by default), which allows:


Story time! - Why I initially created this mod:

  • My vanilla server is pretty old, it was first started in September 2011 (so a little over 5 years old when this story takes place). Thus there were quite a few duplicatd entities accumulated over time. I believe there were around 124 duplicate entities removed when I finally ran the entity duplicate removal command of this mod. Thus there was quite some console spam going on every time certain chunks were loading, because since MC 1.9 the game will print a warning to the console/log, when a new entity is attempted to be spawned in the world and there already exists one with the same UUID. Thus I wanted to clean up all those duplicate entities to get rid of the constant console spam. So I decided to start writing a utility mod which could scan for, and remove all duplicated entities from the world.
  • At the same time, while I was updating the server from 1.8.9 to 1.10.2, I also wanted to clean up the overall "look" of the world (because I have an Overviewer map of it). Since there have been several changes to biome and terrain generation since Beta 1.8.1 (when the server was started), the terrain has quite a few ugly chunk boundaries between areas that have generated in different MC versions. So I wanted a solution to change around some chunks so that the terrain looks more natural and seamless.
  • For this purpose, I added the Chunk Wand item, which can easily change chunks between different versions, so I could "move around" the ugly chunk boundaries to places where they are less noticeble and the different versions of terrain match better.
  • To achieve this, I generated the world (ie. using the same seed my vanilla server uses) in different versions of Minecraft. I generated the world (to about 5000x5000 size) in BEta 1.8.1, release 1.0, 1.1, 1.2.5, 1.6.4 and 1.10.2. Before the 1.2 release biomes weren't yet stored in the world data, but hey were calculated on-the-fly. So I had to also write tiny server mods for beta 1.8.1, 1.0 and 1.1 to export the biome data into separate files. Then I made another tiny server mod for 1.10.2, which can import the biomes from those external files and write that to the chunks, while converting the world from the McRegion [*.mcr] format into Anvil [*.mca]. So then I had completely in-tact versions of the world, in the current Anvil format, with the correct biome data in place, generated in each of the different terrain generator versions since Beta 1.8.1 up until 1.6.4. Then I was able to use those as "alternate worlds" for the Chunk Wand. So I then had the world as it was generated in Beta 1.8.1, 1.0, 1.1, 1.2.5, 1.6.4, 1.10.2 and also the original vanilla server world as an additional copy, for the Chunk Wand to use. Then I was just flying over the entire world, selecting chunks, and either importing the correct biomes from those fixed versions of the world, or changing chunks entirely to different versions from a different MC version, until I was happy that the world looked more seamless and less like cheese.

 

Before you start

Before you do anything with this mod, make sure you have a FULL world backup!
You should be keeping backups of any worlds (or ANY other data you care about in general) anyways, but at least make a FULL backup before using this mod. Many of the operations in this mod are very low level world file manipulations. If something goes wrong, it can permanently destroy parts or even your entire world save! And there is no magical undo! So make a backup first!


 

Chunk Wand

The basic idea of the Chunk Wand is this:

The alternate worlds directory is <worldname<>/alternate_worlds/.
Under that directory should be a directory for each alternate world you want to use, so that inside that alternate world directory should be the region/ directory from that world.

Basically you can just copy & paste worlds inside the alternate_worlds directory to have them available.

NOTE: When you execute a Swap chunk/Import biome/Set biome operation, that data is written directly to the chunk in the current world save! There is no undo!

Tip: If you want to also be able to go back to the current version, then make a copy of the current world inside the alternate_words/ directory too!

But either make it before you copy the other alternate world there (so that you don't end up copying those too...), or alternatively, create a new directory, something like 'current' inside the alternate_worlds directory, and then copy over just the region/ directory from the current world inside that 'current' directory.

Basically you should have a directory structure like this:


 

Commands

The currently implemented "main" commands are:


Note: The entities and tileticks commands ONLY work in unloaded chunks! Also the blockreplace commands are HIGHLY recommended to be only run for unloaded chunks. Running the blockreplace command for loaded chunks is at least somewhere around 50-100x slower, and has some other implications as well (and hasn't been tested that much...).

To be able to use the commands on all your existing chunks while having the chunks unloaded, you should teleport and temporarily move the world spawn somewhere where there is currently no terrain, then re-load the world so that old areas unload. Then run the commands and then teleport back to your regular area and move the world spawn point back.
You can use the /worldutils printspawn command to see your current world spawn if you want to restore it using the /setworldspawn vanilla command, or you could also make a backup of the level.dat file before starting and just restore that afterwards to restore your old spawn.

I would recommend picking a temporary location in the middle of a region file somewhere far away from 0, 0, that way it is easy to simply delete that one region file afterwards to get rid of the temporary area of the world.
To get a location in the middle of a region file, select a location that is x = a * 512 + 256, z = b * 512 + 256. For example a = 40, b = 0 would be at x = 20736, z = 256. This would be in the middle of the region file r.40.0.mca. So the vanilla commands to get there and move the world spawn would be:

NOTE: If you are running these operations/using this mod for a world from another Minecraft version, or otherwise doing these operations without all the usual mods installed, then you should NOT at any point allow any of your actual world's chunks to load (meaning anything other than the temporary area should not be allowed to load)! So in such a case you must move the spawn point by directly editing the spawn coordinates in the level.dat file, using for example the NBT Explorer program, before loading the world for the first time for these operations. Also make a copy of the level.dat file before starting, so you can restore it afterwards, both for restoring the spawn point, and to make sure to preserve the ID maps in it without alterations. And you did read the warning about also making a FULL world backup first, right?!


 

Commands - batch-run

The /worldutils batch-run <filename> command allows running comands from "script files". For example running the blockreplace commands from a text file, instead of having to type or copy and paste them one by one to the game chat.
The command files must be placed in the config/worldutils/batch_commands/ directory. You can tab-complete the filename in the command.
Note: This is in no way tied to just worldutils commands. You can run a list of any valid Minecraft commands from the files.
Tip: Lines starting with '#' as the first character are ignored as comments. Also any blank lines are ignored.


 

Commands - setblock

The /worldutils setblock command allows setting a block at a specific location in the specified dimension to the given block.
This is probably most useful if you have a block that crashes the server or the client as soon as it gets loaded, and you know its exact location in the world (from a crash log perhaps).

The command syntax is simply:
/worldutils setblock <x> <y> <z> <block> [dimension id]

The dimension id is optional if you run the command as a player in the world, then it will use your current dimension.
The block specifier uses the same syntax as in the blockreplace commands.
The recommended/most common form for it is:
/worldutils setblock 123 68 123 minecraft:stone[variant=andesite]
Or without any blockstate properties changed from the default values (or blocks that have no properties):
/worldutils setblock 123 68 123 minecraft:air


 

Commands - inspectblock

The /worldutils inspectblock command allows looking at the block and TileEntity NBT data that is currently saved in the chunk data on disk.

The command syntax is simply:
/worldutils inspectblock <dump | print> <x> <y> <z> [dimension id]

If dump is used as the first argument, then the data is written into a file inside the config/worldutils/ directory.
If print is used as the first argument, then the data is printed to the game console.
The dimension id is optional if you run the command as a player in the world, then it will use your current dimension.


 

Commands - blockreplace

The /worldutils blockreplace command can be used to replace an arbitrary number of different blocks with a single replacement block in one go. So in other words it's a many-to-one replacement operation.

The command itself internally uses two separate lists for the to-be-replaced OR to-be-kept blocks. The blockstatelist is used for specifying ALL blocks from vanilla Minecraft up to and including a given Minecraft version, for example all blocks that exist in Minecraft 1.8.

The blocknamelist on the other hand is used for specifying individual blocks, or all blocks from a certain mod, etc. Basically anything that isn't "all blocks from vanilla version X".

There is one replacement block, which is by default minecraft:air.

The basic stages of using the blockreplace command are:

Managing the blockstatelist

For managing the blockstatelist (for all blocks in vanilla versions), these commands exist:

Note: The add-all-vanilla command will add ALL vanilla blocks up to and including the version specified.

Managing the blocknamelist

The blocknamelist is used for specifying individual blocks. You can add as many blocks to the list at once as you want.
For managing the blocknamelist, these commands exist:

NOTE: If you use a block specifier without metadata or blockstate properties, and if that block type does have sub blocks or metadata, then ALL of those sub-blocks/blocks with different metadata values will essentially be added to the list.

For example, if you use the command:
/worldutils blockreplace blocknamelist add minecraft:stained_hardened_clay
to add stained clay to the list, then ALL the different colors of stained clay will be affected or "added to the list"!
If you print out the list, there will only be minecraft:stained_hardened_clay on it, but when the list of block names eventually gets parsed into the raw numerical IDs upon execution of the command, then entries without metadata or blockstate properties (so only the block ID, or only the block name) will be added for ALL metadata values.
So if you want to target for example only yellow stained clay, add it as minecraft:stained_hardened_clay[color=yellow], or to only target the Granite variant of stone, add it as minecraft:stone[variant=granite].

Setting the replacement block

For managing the replacement block, these commands exist:

Running the replacement operation

After you have set the replacement block, and added all the blocks to be either replaced or kept to the blockstatelist and/or blocknamelist, you will run one of the execute command variants. There are three different variants, for running the replacement in all chunks, or only loaded chunks, or only unloaded chunks.

NOTE: It is HIGHLY recommended to only run the command for unloaded chunks, as that is somewhere around 50 to 100 times or so faster than running it for loaded chunks!

These are the execute command variants:

NOTE: The keep-listed or the replace-listed argument is what defines what the blockstatelist and blocknamelist entries mean. In other words, it defines whether the blocks on the lists are all the blocks that will be replaced, or are those the ONLY blocks that will NOT be replaced.

Note: The stoptask command is not actually specific to the blockreplace command, but it will stop and remove ANY currently running task. There can only be one task of any type running at the same time, because the different commands manipulate the raw world NBT data (when run for unloaded chunks)!

Supported block specifier formats

The replacement set command and the blocknamelist add command take a "block specifier" argument to represent a block.
That block specifier can be in one of the following formats:

Examples

If all this seems confusing, here are some examples. It is in fact very simple.

Example 1: Remove ALL modded blocks from a 1.7.10 modded world:

So this will add ALL blocks from vanilla 1.7.10 to the list, and then set everything else to air.

Example 2: Remove ALL blocks from Biomes O' Plenty from the world

So this will add ALL blocks from Biomes O' Plenty to the list, and then set all of the blocks on the list to air (so in this case all blocks from Biomes O' Plenty).

Example 3: Set ALL Redstone Ore and Diamond Ore blocks to stone in the currently generated chunks in the world

So this will add Redstone Ore and Diamond Ore to the list, and then set all of the blocks on the list to stone.

Example 4: Create a glass world - set ALL vanilla blocks to light gray stained glass in the currently generated chunks in the world

So this will replace all vanilla blocks that exist in 1.11, with light gray stained glass (in the chunks that have been generated so far).


 

Commands - blockreplacepairs

The /worldutils blockreplacepairs command can be used to replace an arbitrary number of blocks, each with a specific replacement block, all in one go. So in other words it's a one-to-one replacement operation.

This command is very similar to the other blockreplace command in many ways. The main difference is, that it doesn't have a single relacement block, but instead you add blocks to the list in pairs: a block to replace, and the block that will replace it. There is also only one list, because there is no need for a all-vanilla-blocks list in this command. Because of certain (thankfully rare) mods with spaces in their block names, there are also special "prepare commands" to add such blocks with spaces in their names to the list.

To "prepare" and add block names with spaces in their name to the name pair list:

For normal blocks without spaces in their names, you would simply add them to the list like so:

There are also the clear, list and remove (and remove-with-spaces) commands to manage the list. The remove commands take the from-block name on the list.

When you have all the block pairs on the list, simply run the execute command. Like with the blockreplace command, there are separate variants for all chunks, loaded chunks and unloaded chunks. Again, only running the command for unloaded chunks is highly recommended. Also this command doesn't have the replace-listed or keep-listed argument, since all the replacement are exactly defined one-to-one.

Example 1: Replace yellow stained clay with gold blocks, and water with lava:


 

Commands - entities

The currently implemented entities sub-commands are:

Note: All of these operations currently only work in unloaded chunks!
Note: The list-all and the list-duplicates-* commands print from a list in memory. So you should run the read-all command first to read the entities from the world files into a list in memory.

The entities remove command in more detail:

The entities rename command in more detail:


 

Commands - tileticks

The currently implemented tileticks sub-commands are:

The remove-by-mod and remove-by-name commands have several sub commands:

Note: All of these operations currently only work in unloaded chunks!


 

Commands - registry

There is currently only one command implemented:

Mod packs/permissions

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more