A command-line editor is now included with my Python library for Minecraft levels. This editor has almost all of the features of MCEdit. To use it, clone the repository and then run python mce.py
Caution: Do not attempt to edit a "live" map while the server is running. Always shut down the server before making edits.
What is it good for?
Server operators can edit a world directly on the server. There is a degrief command to help reverse the effects of griefers: it will remove any Fire, Lava, Obsidian, or Adminium in places where they don't belong. The removeEntities command will help you combat another kind of griefing by removing dropped items, minecarts, monsters, and other entities that may be slowing down the game. (Tile entities such as chests are untouched.)
The commands analyze and dumpSigns will collect different information about the world. Use the help command to find out more.
Here's how you use them:
degrief
$ python mce.py 'D:\MinecraftServer\waterworld' degrief
Identifying D:\MinecraftServer\waterworld
Can't read, attempting to open directory
Saved 0 chunks
Scanning for chunks...
Found 1130 chunks.
Detected Alpha world.
Removing grief matter and surface lava above height 32...
[ progress output removed ]
Replace: Skipped 1122 chunks, replaced 56 blocks
Asked to light 8 chunks
[ more progress removed ]
Completed in 0:00:09.870000, 0:00:01.233750 per chunk
Saved 1130 chunks
removeEntities
$ python mce.py 'D:\MinecraftServer\waterworld' removeEntities
Identifying D:\MinecraftServer\waterworld
Can't read, attempting to open directory
Saved 0 chunks
Scanning for chunks...
Found 1130 chunks.
Detected Alpha world.
Removing all entities...
Removed entities:
Chicken: 4
Cow: 2
FallingSand: 175
Pig: 4
Sheep: 5
Asked to light 0 chunks
[ more progress removed ]
Saved 35 chunks
A few things to keep in mind:
- The world is saved automatically on end of input. If you want to abort your editing session, use quit no or type Control-C.
- Use the correct case for a block name to ensure an exact match.
- import can bring in a lot of different formats, including Classic levels, Indev levels, .schematic and .inv files.
- export always saves in .schematic format.
- prune can be used to cut down a level's size.
Here's a sample session with mce.py:
$ python mce.py 'D:\MinecraftServer\testworld'
Identifying D:\MinecraftServer\testworld
Can't read, attempting to open directory
Saved 0 chunks
Scanning for chunks...
Found 463 chunks.
Detected Alpha world.
testworld> help
Usage:
Block commands:
clone <sourcePoint> <sourceSize> <destPoint> [noair] [nowater]
fill <blockType> [ <box> ]
replace <blockType> [with] <newBlockType> [ <box> ]
export <filename> <sourcePoint> <sourceSize>
import <filename> <destPoint> [noair] [nowater]
createChest <point> <item> [ <count> ]
analyze
Player commands:
player [ <player> [ <point> ] ]
spawn [ <point> ]
Entity commands:
removeEntities [ <EntityID> ]
dumpSigns [ <filename> ]
Chunk commands:
createChunks <box>
deleteChunks <box>
prune <box>
relight [ <box> ]
World commands:
degrief
Editor commands:
save
reload
load <filename> | <world number>
quit
Informational:
blocks [ <block name> | <block ID> ]
help [ <command> ]
**IMPORTANT**
box
Type 'box' to learn how to specify points and areas.
testworld> box
Usage:
Boxes:
Many commands require a <box> as arguments. A box can be specified with
a point and a size:
(12, 5, 15), (5, 5, 5)
or with two points, making sure to put the keyword "to" between them:
(12, 5, 15) to (17, 10, 20)
The commas and parentheses are not important.
You may add them for improved readability.
Points:
Points and sizes are triplets of numbers ordered X Y Z.
X is position north-south, increasing southward.
Y is position up-down, increasing upward.
Z is position east-west, increasing westward.
Players:
A player's name can be used as a point - it will use the
position of the player's head. Use the keyword 'delta' after
the name to specify a point near the player.
Example:
codewarrior delta 0 5 0
This refers to a point 5 blocks above codewarrior's head.
testworld> help replace
Usage:
replace <blockType> [with] <newBlockType> [ <box> ]
Replace all blockType blocks with newBlockType in a cuboid
starting at point and extending for size blocks in
each direction. Without a destination, replaces blocks over
the whole world. blockType and newBlockType may be numbers
from 0-255 or names listed by the 'blocks' command.
testworld> help blocks
Usage:
blocks [ <block name> | <block ID> ]
Prints block IDs matching the name, or the name matching the ID.
With nothing, prints a list of all blocks.
testworld> blocks snow
ID : Block name
78: Snow
80: Snow Block
testworld> replace Snow with Snow Block
Replacing Snow with Snow Block
Filled 100...
Filled 200...
Filled 300...
Filled 400...
Replace: Skipped 129 chunks, replaced 70722 blocks
Replaced 15826944 blocks.
testworld> help player
Usage:
player [ <player> [ <point> ] ]
Move the named player to the specified point.
Without a point, prints the named player's position.
Without a player, prints all players and positions.
In a single-player world, the player is named Player.
testworld> player
Players:
codewarrior: [23.5, 65.0, -59.5]
testworld> fill Glass codewarrior delta -10 10 -10 20 1 20
Filling with Glass
Filled 400 blocks.
testworld> player codewarrior codewarrior delta 15
Error decoding point input (expected more values).
Usage:
player [ <player> [ <point> ] ]
Move the named player to the specified point.
Without a point, prints the named player's position.
Without a player, prints all players and positions.
In a single-player world, the player is named Player.
testworld> player codewarrior codewarrior delta 0 15 0
Moved player codewarrior to (23.5, 80.0, -59.5)
testworld> replace leaves with solid gold
Replacing Leaves with Solid Gold Block
Filled 100...
Filled 200...
Filled 300...
Filled 400...
Replace: Skipped 193 chunks, replaced 35517 blocks
Replaced 15826944 blocks.
testworld> save
Asked to light 334 chunks
Batch 1/1
Lighting 387 chunks
Dispersing light...
BlockLight
Pass 0 : 387 chunks
Pass 1 : 111 chunks
Pass 2 : 104 chunks
Pass 3 : 95 chunks
Pass 4 : 90 chunks
Pass 5 : 84 chunks
Pass 6 : 78 chunks
Pass 7 : 70 chunks
Pass 8 : 67 chunks
Pass 9 : 61 chunks
Pass 10 : 52 chunks
Pass 11 : 39 chunks
Pass 12 : 26 chunks
Pass 13 : 15 chunks
SkyLight
Pass 0 : 387 chunks
Pass 1 : 363 chunks
Pass 2 : 278 chunks
Pass 3 : 201 chunks
Pass 4 : 106 chunks
Pass 5 : 57 chunks
Pass 6 : 33 chunks
Pass 7 : 19 chunks
Pass 8 : 18 chunks
Pass 9 : 15 chunks
Pass 10 : 9 chunks
Pass 11 : 8 chunks
Pass 12 : 4 chunks
Pass 13 : 0 chunks
Completed in 0:00:59.918000, 0:00:00.179395 per chunk
Saved 463 chunks
testworld>
No, the images are correct. In the sample session, I replace snow with snow blocks, replace leaves with gold blocks, create a glass platform in the air, and then teleport myself up to it.
replace Stationary water with Stationary lava
replace Water with Lava
replace Grass with Dirt
replace Dirt with Sand
replace Leaves with Air
replace Tree with Cactus
Do you know if this works on Python 2.5.2? I get this when I run mce.py:
root@trellia:/minecraft/pymclevel# python mce.py
Traceback (most recent call last):
File "mce.py", line 1, in <module>
import mclevel
File "/minecraft/pymclevel/mclevel.py", line 112, in <module>
import nbt
File "/minecraft/pymclevel/nbt.py", line 192, in <module>
class TAG_Compound(TAG_Value, collections.MutableMapping):
AttributeError: 'module' object has no attribute 'MutableMapping'
That worked. I got an "Can't assign to operator", but realized I left the + in front of the edited line.
Also, for entity IDs, is this just block/tool ids, or do they differ? I have... a million unpickedup minecart tracks that crash my server and want to remove them. Are they considered ents?
Entity IDs are always text strings and completely different from the block and item ID numbers. help removeEntities for a list of them.
The only place they come together is in the 'Item' entity. That's the entity represented by the unpickedup minecart tracks. There's no way to remove specific item types (yet). You probably want to run removeEntities Item and wave goodbye to any other items sitting on the ground.
Entity IDs are always text strings and completely different from the block and item ID numbers. help removeEntities for a list of them.
The only place they come together is in the 'Item' entity. That's the entity represented by the unpickedup minecart tracks. There's no way to remove specific item types (yet). You probably want to run removeEntities Item and wave goodbye to any other items sitting on the ground.
It'll finish in finite time. Be patient. Sorry there's no progress output for that one. I can't say how long it'll take, but it probably depends on how many millions of items were left on the ground.
Trying to replace lava/stat lava near myself with air, and I receive the following:
threetides> replace 10 0 Eaglebird 9
Error decoding point input (expected more values).
Usage:
replace <blockType> [with] <newBlockType> [ <point> <size> ]
Replace all blockType blocks with newBlockType in a cuboid
starting at point and extending for size blocks in
each direction. Without a destination, replaces blocks over
the whole world. blockType and newBlockType may be numbers
from 0-255 or names listed by the 'blocks' command.
threetides> replace 10 0 Eaglebird delta 0 4 0 6
Error decoding point input (expected more values).
threetides> replace 10 0 0 0 0 8
Error decoding point input (expected more values).
threetides> replace 10 0 [0 0 0 8]
Cannot find player [0
Players:
Eaglebird: [7.1781657105105063, 69.0, -4.2515509134654135]
threetides> replace 10 0 Eaglebird 8
Error decoding point input (expected more values).
How should I be entering points? Parentheses???
threetides> replace 10 with 0 1 1 1 1 1 1 1 1
Replacing Lava with Air
Replace: Skipped 1 chunks, replaced 0 blocks
Replaced 1 blocks.
"Expected more values"? "command block with newblock pointx pointy pointz size # # # # # ???"
If the size is a triple value for x y and z, it doesn't seem to be working. I get
threetides> replace 10 with 0 0 0 0 8 128 8
Replacing Lava with Air
Replace: Skipped 0 chunks, replaced 8 blocks
Replaced 8192 blocks.
A size has three dimensions, not one. Think replace block with newblock pointx pointy pointz sizex sizey sizez
Lava and Stationary lava are different materials, so you'll need two replace commands. I should probably just do this automatically because nobody knows or even gives a damn about the difference.
A size has three dimensions, not one. Think replace block with newblock pointx pointy pointz sizex sizey sizez
Lava and Stationary lava are different materials, so you'll need two replace commands. I should probably just do this automatically because nobody knows or even gives a damn about the difference.
I know the difference; one creates obsidian, the other creates cobblestone. One's top slants as it moves forward, the other is flat.
That's wrong, and you shouldn't give a damn. Lava has tile-tick logic applied to it during each game tick; Stationary lava does not. Spring blocks and sloping fluid blocks can be either type - spring blocks are the ones where BlockData is 0. The game will automatically convert a fluid to a stationary fluid and vice versa.
This probably explains why the game bogs down or crashes after filling a huge area with Lava. (Huh, on second thought, maybe people SHOULD give a damn.)
Direct download includes Python source code and schematic files. (Usually outdated - check the git repo for the latest)
Requires Python 2.6 and numpy. Reported working on different varieties of Linux. CentOS5 install instructions.
Caution: Do not attempt to edit a "live" map while the server is running. Always shut down the server before making edits.
What is it good for?
Server operators can edit a world directly on the server. There is a degrief command to help reverse the effects of griefers: it will remove any Fire, Lava, Obsidian, or Adminium in places where they don't belong. The removeEntities command will help you combat another kind of griefing by removing dropped items, minecarts, monsters, and other entities that may be slowing down the game. (Tile entities such as chests are untouched.)
The commands analyze and dumpSigns will collect different information about the world. Use the help command to find out more.
Here's how you use them:
degrief
removeEntities
A few things to keep in mind:
- The world is saved automatically on end of input. If you want to abort your editing session, use quit no or type Control-C.
- Use the correct case for a block name to ensure an exact match.
- import can bring in a lot of different formats, including Classic levels, Indev levels, .schematic and .inv files.
- export always saves in .schematic format.
- prune can be used to cut down a level's size.
Here's a sample session with mce.py:
Before:
After:
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
Server problems? Email me: [email protected]
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
Thanks.
Server problems? Email me: [email protected]
Please consider donating if you appreciate my work!
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
making an all desert world...
Anoniempje: You can specify a region to replace over - see help replace. You can't do live edits with it unless you know exactly what you're doing.
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
It also has a problem with memory with an older version of NumPy:
Just pushed the fix to pymclevel.
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
That worked. I got an "Can't assign to operator", but realized I left the + in front of the edited line.
Also, for entity IDs, is this just block/tool ids, or do they differ? I have... a million unpickedup minecart tracks that crash my server and want to remove them. Are they considered ents?
The only place they come together is in the 'Item' entity. That's the entity represented by the unpickedup minecart tracks. There's no way to remove specific item types (yet). You probably want to run removeEntities Item and wave goodbye to any other items sitting on the ground.
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
How long should the operation take?
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
How should I be entering points? Parentheses???
"Expected more values"? "command block with newblock pointx pointy pointz size # # # # # ???"
If the size is a triple value for x y and z, it doesn't seem to be working. I get
But the actual level is unchanged. ?
Lava and Stationary lava are different materials, so you'll need two replace commands. I should probably just do this automatically because nobody knows or even gives a damn about the difference.
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum
I know the difference; one creates obsidian, the other creates cobblestone. One's top slants as it moves forward, the other is flat.
This probably explains why the game bogs down or crashes after filling a huge area with Lava. (Huh, on second thought, maybe people SHOULD give a damn.)
"We will absolutely not keep in mind what external mapeditors will have to do to read data from the disk, that makes no sense whatsoever." - Grum