I've lost a command block, how can I find it?

I've placed a command block making it day all the time. I want to turn it off, but I've lost it. What's the quickest way to find it?


Solution 1:

You can use NBTExplorer for this.

Why? Because the command(s) you had in your command blocks are stored in the NBT data of the command block. Using NBTExplorer, you can find the command block, but only if:

  • you remember all or a part of the command written in it

  • the command in it isn't in too many other blocks in the world

If you do not know any part of the command being run, try typing "@", "/" or " " into the search box. (Thanks to @MBraedley for the notice)


How to install NBTExplorer:

You will have to have .NET framework 2.0 (or higher) to run the program. You can download the installer for Windows (and Linux with mono-core and mono-winforms packages installed) here and here for Mac.

After downloading, unzip the .zip file (I recommend doing so to do this in a new folder). Then run the program labeled "NBTExplorer.exe"


How to use NBTExplorer

One you have installed the application, run it. Then proceed by these steps:

  1. Click on File in the upper tab and then select Open Minecraft Save Folder (not needed in newer versions)

  2. Select your world from the GUI. Double click on it after it shows in the window, and then single-click (select) the folder "region":

Nice, right?

If you look inside it (not needed), you should see files labeled *.mca or *.mcr, for example "r.0.1.mcr"

  1. Click Search in the upper tab and then Find in the list that appears:

Wow!

  1. A window named "Find" will pop up. Inside will be two checkboxes and two text areas next to them. Check both boxes. In the first empty text box, enter "Command". In the second one, type any part of the command in your command block you remember. I guess that you used the command "time set day". If so, enter that command into the box. Else enter any part of the command you remember:

Did you see that? Pure skill!

  1. Click on Find or press Enter on your keyboard. After a while (depending on your world size, from seconds to minutes), your search will return a result (the first it found) - it will show you the full command, the coordinates and some more NBT data of the command block with the command you searched for:

Again, such wow

My testing world (the map The Dropper) didn't have the command "time set day" anywhere, so instead I searched for /spawnpoint:

entered image description here

  1. If this is the command block you searched for, take the coordinates it gave you (X, Y, Z) and teleport to them in Minecraft by /tp @p X Y Z.

  2. If the command block it found is not the one you searched for, press Search on the upper tab, and then press Find next in the list that pops up:

entered image description here

Then, repeat steps 5-7 until you find your command block!

  1. If the program didn't find the wanted result, try searching for something else (eg. just time set instead of time set day).

For further reference, here are some links:

  • Minecraft Forum NBTExplorer post and FAQ

  • Minecraft Wiki: NBT tags

  • Windows/Linux and Mac download links

  • GitHub project page

  • Edit: A very simmilar answer by MrLemon

Solution 2:

Download MCEdit and select the region you think the command block is in. Then use the search option for ID 137 (command block).

Solution 3:

I've never used MCEdit. However, here might be a couple tips:

  • If you've spent a lot of time in that chunk, or near it, press f3 to open debug info and check the regional difficulty. Regional difficulty tells you how much time you've spent in that chunk, since Minecraft makes it more difficult if you've spend more time in a chunk.
  • If your command block is underground (as in surrounded by masses of stone) or just buried somewhere, type in /gamemode 3 to launch Spectator Mode. Spectator Mode allows you to go through blocks - when you're inside a block, other blocks are hidden unless there's an opening (hard to explain). You can try it yourself. If your command block is in some giant mass of blocks, you should be able to find it like that quickly.

  • I might be wrong, but I'm pretty sure that command blocks don't load chunks. (If they do, correct me.) Turn on command block chat outputs and turn render chunks on to a high. If you get the outputs, then set it lower and poke around until you find the right chunk.

Hopefully these help you!

Solution 4:

Losing Command Blocks can be problematic. I would first try using /gamemode spectator to look around and fly through your world before downloading MCEdit Unified (which is well-respected community branch maintained of MCEdit) and searching around.

In MCEdit Unified:

  1. Open your world (level.dat)
  2. Press TAB to switch to Chunk View
  3. RIGHT-CLICK and HOLD to move around your world until you see some yellow outlines
  4. Use the MOUSEWHEEL to zoom and center on your chosen area
  5. Press TAB to switch back to Camera View
  6. Use WASD and your MOUSE to fly around to locate your block
  7. Delete the block in MCEdit (click to select, a menu will open) or open your world to get rid of it

Good luck. :)

Solution 5:

look in your logs. it logs the xyz location and command of the command block, every time it issues a command