Delete all command blocks without opening minecraft world [duplicate]
If you are running this world on a multiplayer server, you can disable command blocks completely via the server properties. Shut down the server, open server.properties
with a text editor of your choice and set
enable-command-block = false
This disables all command blocks. Join the game, destroy the command block in question and reenable them afterwards.
In singleplayer, it's a bit more complicated. You have to open the world as a multiplayer* server. Open server.properties
and set
level-name = [relative path to your savegame]
e.g. saves/world
(use /
to divide folders).
*If you haven't run a multiplayer server yet, you can download the server.jar (or server.exe) from the Minecraft website and save it wherever you want. Run it once to generate some files, including server.properties
and a savegame called world
.
To join your own server, connect to localhost
or 127.0.0.1
in Minecraft.
For situations like this, an external world-editing tool is best. Find the command block, and delete it.
A common one is MCEdit, which is available here: http://www.mcedit.net/
As @MrLemon mentions, you could be running a multiplayer server, in which case MCEdit is a bad idea -- the download time of a 60GB map is non-negligible. In that case, follow his answer.
/fill X1 Y1 Z1 X2 Y2 Z2 minecraft:air
Fill in X Y and Z with the approximate coordinates of the command block, and you've replaced a region around the command block with air.
Another alternative is to change the command using NBTExplorer. This tool is much less powerful than MCEdit, but it easier to use and does work for this case. This works largely the same as my answer here, so feel free to reference that in case something is unclear. The crucial thing is that you have to remember either where your command block is located, or any semi-unique part of your command.
Command Blocks are Tile/Block Entities, since a regular data value is not enough to store all information about them. Instead, they have NBT data similar to entities, which are detailed on the wiki. In particular, command blocks ("Control") have a Command
entry. NBTExplorer is able to read the region format and search for a Tile Entity with a specific entry.
Close Minecraft. Open up the program and select File > Open Minecraft Save Folder. You will get a list of folders corresponding to your worlds. Open up the world you want to search, and select the "Region" folder.
Use Search > Find (Ctrl+F) to look for Name: Command and Value: [your command snippet] until you have found the command block in question (This is described in greater detail in the answer linked above).
Double-Click the Command entry and change it's value to either fix the command directly (for example, turn
\kill @e[type=!player]
into\kill @e[type=!Player]
) or just enter something harmless (e.g. leave it empty).Press the save button and close NBTExplorer. When you open up your world in Minecraft, the command should be changed.
Destroy the block using a world editor, then use a command block to comparator for the test part with the /testfor
command.
You want the comparator to go to a command block that just puts up a message to find out if the /testfor
command and comparator are working properly. Do not start the /tp
command until you have confirmed that the first two parts are working in conjunction with each other properly.