How do I locate command blocks? I was messing around with some commands and died, and lost the location where I was testing out a lot of stuff. I do not have access to MCEdit or anything like that. I accidentally took a screenshot, but didn't have co-ords up, if that helps.
As long as you remember any semi-unique part of your command1, you can use NBTExplorer.
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.
Open up the program and select File > Open Minecraft Save Folder2. You will get a list of folders corresponding to your worlds. Open up the world you want to search, and select the "Region" folder.
Go to Search > Find (Ctrl+F). In the popup, under Name, enter "Command", and set Value to your code snippet. For example, I remember testing something on Pigs a while back, and I know that I used
type=Pigin one or more commands in that contraption.
Click on Find and wait. If you remember your command snippet correctly, the program will find the corresponding Tile Entity. First of all, it shows you the exact command used. If that is not what you want, go to Search > Find Next (F3) and repeat this step. It also shows you the xyz coordinates of the block, which you can use to teleport yourself to the command block in game.
This method can be used to locate all Tile Entities and regular Entities in a savegame, as long as you have sufficiently unique NBT data for it. For example, you can use it to locate that Chest that you put your "Gunblade" in (
name:Gunblade), or figure out where your horse of yours has wandered off to (
[your UUID] or
1 Meaning there shouldn't be too many command blocks including that snippet.
2 If you have set a different Game Directory for your Minecraft profile, select *Open Folder" and navigate to your saves manually.