[Advanced] Minecraft Savegame.dat Structure/Editing

Hakukoru Sep 24, 2012

  1. Ha

    Hakukoru Newbie
    0/47

    Joined:
    Aug 27, 2012
    Messages:
    4
    Likes Received:
    4
    Trophy Points:
    0
    Console:
    Other
    The goal of this tutorial is to show you how to extract files out of your savegame.dat file. These files (particularly "level.dat" and the individual player files) can be opened up in NBTExplorer, allowing you to alter your inventory and change the time of day and weather of your world. It's also possible to extract the region files, but I believe the Xbox 360 format of these files uses a different type of compression, and are incompatible with typical Minecraft PC tools.

    Part 1 - 360Revolution
    Using the USB Explorer in 360Revolution, extract the Minecraft save file to your computer. Next, open that file (it should have a .bin extension) using the 360Revolution Package Manager, and extract the "savegame.dat" file.

    Part 2 - Fairchild's Minecraft 360 Compression Toolkit
    Use fairchild's compression toolkit to decompress your savegame.dat file. If you are unsure where to get this tool, it is the "minecraft.exe" that comes bundled with the Minecraft 360 Save Editor (found here).

    Usage: minecraft.exe -d savegame.dat savegame-decompressed.dat

    Part 3 - Find the offset for the Index
    For the next few parts you will need a hex editor. I recommend the freeware editor HxD.
    Open the decompressed "savegame-decompressed.dat" in your hex editor of choice. So far, I've uncovered a number of things about this file. First, the first 4 bytes of the file are an offset to an "index" that occurs at the end of the file, and the next 4 bytes indicates how many files are in it. For example, my save begins with "00 D6 64 69" followed by "00 00 00 10", meaning the index begins at offset D66469, and references 16 files (10 in hex -> 16 in decimal).

    Part 4 - Extract the Index
    Once you have the offset from part 3, open the Search menu and select Goto (or press Ctrl+G). Enter your offset in the box that pops up (D66469 for me), and choose Hex and Begin for the other options. Press OK, and you will be at the very beginning of the Index. From this point on until the end of the file is the full index. I recommend selecting all of it, then cut and paste it into a new file.

    Part 5 - Reading the Index
    With the index copied to a new file, go to the View menu, and change "Bytes per row" to 144. This will stretch HxD out quite a bit, and make it easier to tell each line apart, as each file will have its own row. So far the only useful files to edit are the level.dat, or the players/########.dat files. Your players save file will be your Xbox Profile ID, converted from hex to decimal. Once you've decided which file to extract, we need to figure out the offset and length of the file. Within the same row as the file name, the 4 bytes following the name (80-83) are the length of the file. The next 4 bytes (84-87) are the offset. For my level.dat file, the length was "00 00 00 DC" (decimal 220) and the offset was "00 A7 B0 0C".

    Part 6 - Extract your file
    Switch back to the "savegame-decompressed.dat" tab in HxD, and open the Select Block window (Edit->Select Block, or Ctrl+E on your keyboard). Enter your offset and length from part 5, choose Hex, and press OK. Now copy this chunk, and paste it into another new file. I recommend saving it with the original name to keep things straight if you extract multiple files. Additionally, before you continue to the next step, close the tab for the file you're trying to edit to prevent issues in part 6.

    Part 7 - Edit the extracted file in NBTExplorer
    Open NBTExplorer (found here), and open the folder that you've been working in. It should recognize your index.dat and [player ID].dat files automatically, and give you a tree-view of their contents. In the level.dat file, it's possible to adjust the time on the map, turn rain on and off, adjust the spawn point for new players, or check the seed of the map. (Fun fact: the seed used for the tutorial level was 1171544198849424676). For player files, you can edit your health (max is 32,767), edit your inventory (nested sections with 4 values, Quantity, Slot number, Damage, and Quantity). For tools/weapons it is possible to make them invincible by setting damage to a high negative value (not recommended for armor, as it appears to cause a glitch where you are killed in one hit, and never respawn). To max out the quantity of an item, set it to -1 and you'll get stacks of 255 in-game. For a list of ID numbers and possible numbers, check out the Minecraft wiki entry here.

    Part 8 - Starting to put it back together
    Once you've finished modifying your file in NBTExplorer and saved it, open it back up in HxD. Press Ctrl+A to select the full contents of the file, and copy them. Switch back to the "savegame-decompressed.dat" tab and select the original block for your file (follow the first half of step 6 to select the Offset/Length). Next, press Ctrl+V to paste, and it will overwrite your selection with the contents that you've edited.

    Part 9 - Fixing the Index
    Now, chances are, when you edited your files, the length of the file will have changed. If the file you were working with was the last one in the "savegame-decompressed.dat", then skip this part. If not, we have a little more work to do. Switch to the tab in HxD where we pasted the Index earlier. Using parts 5 & 6 of this tutorial as a guide, locate and change the length of the file you were working on. Now we need to adjust the offsets of the rest of the files that follow. Using a calculator, add the offset and the length of the file you were working on, and use the result as the offset for the next file. Then add the length of that file to get the offset for the next-next file. Repeat until you've reached the bottom of the index. Note: Combine the offset and length of the last file mentioned in the index to get the new offset for the index.

    Part 10 - Put the Index back
    Copy the full contents of the Index, and paste it at the very end of "savegame-decompressed.dat". If you did not get to skip Part 9, be sure to update the offset for the index at the very beginning of the file (the first 4 bytes mentioned in Part 3). Save the file, and we are almost done!

    Part 11 - Re-compress
    Using fairchild's compression toolkit from Part 2, re-compress the file.

    Usage: minecraft.exe -c savegame-decompressed.dat savegame.dat

    Part 12 - Back to 360Revolution
    Using the Package Manager feature, open the original *.bin file for your save. Replace the "savegame.dat" file with the one we've been working on. Finally, click "Rehash and Resign", then transfer the completed *.bin file to your memory card.

    Part 13 - Just kidding about this part, you're actually done!
    Hopefully this tutorial wasn't too difficult for you. Perhaps if someone reading this has skills in programming, you can take this method and write a tool to do the dirty-work of parts 3-10 and output all the files at once? ;)
     
  2. Ol

    Olivar757 Newbie
    0/47

    Joined:
    Jun 8, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Console:
    Xbox
    How do you find the offset?
     
  3. Shadow

    Shadow Watchers Staff Member XPG Moderator
    430/564

    Joined:
    Mar 9, 2011
    Messages:
    8,986
    Likes Received:
    1,414
    Trophy Points:
    430
    Gender:
    Male
    Location:
    Floating in Space having a beer with the guy who d
    Console:
    Xbox One
    Part 3 - Find the offset for the Index
    For the next few parts you will need a hex editor. I recommend the freeware editor
    HxD.
    Open the decompressed "savegame-decompressed.dat" in your hex editor of choice. So far, I've uncovered a number of things about this file. First, the first 4 bytes of the file are an offset to an "index" that occurs at the end of the file, and the next 4 bytes indicates how many files are in it. For example, my save begins with "00 D6 64 69" followed by "00 00 00 10", meaning the index begins at offset D66469, and references 16 files (10 in hex -> 16 in decimal).
    :eek:
     
  4. ya

    yahir95 Newbie
    0/47

    Joined:
    Jan 11, 2013
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Playstation 3
    dude plz make a video, i beg you,
    it would be much easier plz
     
  5. ya

    yahir95 Newbie
    0/47

    Joined:
    Jan 11, 2013
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Playstation 3
    in part10 should i copy all the index and paste it in the file that im gonna use?
    when i do that i get 2 index', isnt enough with one?
     
  6. x8

    x87xeLDiAbLo Newbie
    0/47

    Joined:
    Jan 17, 2013
    Messages:
    1
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Xbox
    My biggest question is what exactly do you mean by putting the offsets into a new file? Because I think I'm messing up when the NBTExplorer needs to be used. Can you please make a video tutorial over this? It would make things so much clearer and easier to understand!
     
  7. la

    lawtonokieguy Newbie
    0/47

    Joined:
    Nov 9, 2010
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Xbox
    I agree on video version. I get totally lost on the step 5
     
  8. la

    lawtonokieguy Newbie
    0/47

    Joined:
    Nov 9, 2010
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Xbox
    Can someone please make a video on this cause I am totally freakin lost on step 5.
     
  9. ma

    magnadox Newbie
    0/47

    Joined:
    Feb 20, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Console:
    Xbox
    this seems like it would be very simple to make a program that automated this, if i understand correctly all you would have to do is
    output the hex to text
    then you could have a program isolate the .dat file easily

    EFFECTIVELY YOU COULD CREATE A XBOX TO PC CONVERSION!

    maybe it will not be backwards compatible but you could still use all sorts of tools for the PC version to find diamond, monster spawners ECT

    very exciting, i have enough programming knowledge to see that this is the beginning of an amazing program but not enough to create it myself. hah
     
  10. th

    thedevil5600 Newbie
    0/47

    Joined:
    Oct 16, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Console:
    Xbox
    Can anyone please help me on step 5 and maybe explain it a bit more as i don't know how to find the offset and the length?
     
  11. Ro

    Rocky5 Newbie
    0/47

    Joined:
    May 14, 2012
    Messages:
    45
    Likes Received:
    29
    Trophy Points:
    0
    Console:
    Xbox
    Its a pity there isn't a mcr extractor, its easy enough to get the lengths & offsets & then create the files, just the old MCEdit doesn't load them correctly. (checkers appear but no terrain)

    I have tried flipping bites & changing stuff to no avail, I also imported part of my PC world onto the xbox, but it crashes the console :-(

    OK, I have made a little tool that will extract all the files from the decompressed save, its not ready yet & bugger knows how im going to re import them :-/
     
  12. Barbarac

    Barbarac Newbie
    0/47

    Joined:
    Jul 21, 2013
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Playstation 3
  13. Ro

    Rocky5 Newbie
    0/47

    Joined:
    May 14, 2012
    Messages:
    45
    Likes Received:
    29
    Trophy Points:
    0
    Console:
    Xbox

Share This Page

Close