7

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.

  • Sorry, but it's simply not possible. | You can't just teleport to a random block of a specific type in Vanilla... Not even detect and print out the location of them. Although I'd like to be able to do that with Diamond Ore... – aytimothy Mar 6 '15 at 8:34
  • Well, it's possible, but it'll take forever. Try /testforblock on every single possible block that's not Sandstone; so for a Redstone flat world, Y is more than 56 (or 64; forgot the max height) – aytimothy Mar 6 '15 at 8:35
  • It's not a superflat world :/. But how would you testforblock within a radis? – user104815 Mar 6 '15 at 13:37
  • Then that's going to get worse. Because you'll have to scan every single block, which will take forever. Alternatively, use a map editing program. – aytimothy Mar 6 '15 at 13:57
  • 2
    Like @aytimothy said, Try using a map editing program. I know you said you don't have access to MCEdit, but try downloading it, and select a large area within the map, and use the analyze function. This will return every block within the area you selected and how many of them there are. – Dorian Dore Mar 6 '15 at 15:34
5

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.

  1. 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.

  2. 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=Pig in one or more commands in that contraption.

    enter image description here

  3. 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.

    enter image description here

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 (Items, name:Gunblade), or figure out where your horse of yours has wandered off to (OwnerUUID, [your UUID] or Tame, 1).

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.

1

You cannot.


Your screenshot won't help if there is no co-ordinates on it.


You can use a map renderer to (hopefully) find your command block though, like Minecraft Overviewer or MCEdit.

1

You could download X-Rays or something and turn them on... But make sure your render distance is on a very far amount.

Not the answer you're looking for? Browse other questions tagged or ask your own question.