Life is over. Or is it?
This exact thing happened to me (seriously; my cat is a dick). I wasn't about to give up so easily though.
I spent an hour or two researching, and after pulling together data from several sources; I found a way to (almost) fully restore my world.
Let's talk about what happens first. When the game shuts down unexpectedly, a file called level.dat will become corrupted. In my case, it was full of null bytes. In other cases i suppose it would be possible to have partial data in there. This is no matter though.
There is another file called level_old.dat. This is supposed to be a backup of some sort. Many people suggest using it by renaming it to level.dat; restoring your world. This did not work for me as it had ALSO been nulled out. That is when the responses I found basically amounted to "you're fucked". But you know what?
You are not.
It is entirely possible to create a level.dat "template", which can be used to restore your world almost entirely (minus your inventory, but there is a way around this too)
level.dat stores current state information about the player. Health, inventory being carried, position on map, direction facing, etc. The rest of your map is stored elsewhere. This means that we can use a vanilla level.dat file to help us gain access to our world!
DISCLAIMER: This works for Alpha (single player), but I have no idea if it works for other releases (or multi player).
Tools you will need:
[*:3rz1ijbd]level.dat file attached to this post. NOTE: I was unable to attach the file, so you will need to manually create it using NBTedit and the data below. =/
- [*:3rz1ijbd]Navigate to the location of your Minecraft saves. In Windows 7, the path is "C:\Users\
[*:3rz1ijbd]In this folder you will see subfolders for each world (world1, world2, etc.). Find the world you wish to restore and make a backup copy of the folder, just in case.
[*:3rz1ijbd]Open the folder containing your world. You should see a plethora of sub directories. Ignore these. Scroll down and you will see three files:
[*:3rz1ijbd]replace the level.dat file in your world folder with the level.dat file attached to the post.
[*:3rz1ijbd]Open it up in NBTedit.
[*:3rz1ijbd]You should see something similar to the following:
- [*:3rz1ijbd]root: 1 entry
- [*:3rz1ijbd]Data: 9 entries
- [*:3rz1ijbd]SnowCovered: 0
[*:3rz1ijbd]Player: 1 entry
- [*:3rz1ijbd]Score: 0
[*:3rz1ijbd] Did you have a winter wonderland? If so, set SnowCovered to 1
[*:3rz1ijbd] LastPlayed is the UNIX timestamp of the last time you played. Get the UNIX timestamp of shortly before you crashed. This does not have to be exact (and in fact, i am not sure if it needs to be filled in, but I did so I suggest you do). http://www.unixtimestamp.com should make this simple.
[*:3rz1ijbd]SizeOnDisk should be set to the approximate size of your world, in bytes. You can get this by finding the size of the world folder you are restoring, then converting from megabytes to bytes. 1 megabyte = 1,048,576 bytes. Again, this does not have to be exact. Just make it a close as possible.
[*:3rz1ijbd]Time defines time of day in the world. This can range from 0 to 24000. I set this to 6000 in the sample level.dat as convenience. This will start you with the sun high in the sky. You can play with this if you want to start at a different time of day.
[*:3rz1ijbd]After making these edits, save the file, and start Minecraft.
[*:3rz1ijbd]When you get to the world selection screen, you should now see your world. select it.
[*:3rz1ijbd]Something very strange might happen. When I did this, I fell right through the geometry, and died. When I respawned though, I was back on land, somewhat near my spawn point. You might experience strange things too. Don't worry, you still have that backup we made before we started in case things are rockier for you than I.
[*:3rz1ijbd]Optionally, you might want to walk around and make sure your structures are still there. They should be.
[*:3rz1ijbd]Once you are alive and on land and the game isn't freaking out, you'll notice your inventory is gone! We can't restore this, but we CAN rebuild an inventory list of our liking. grab some dirt. I'm serious. One piece will do.
[*:3rz1ijbd]Save world and exit Minecraft.
Done! You may now continue wasting your life on Minecraft. But wait, what about my items!? If you do not feel like going through the trouble of collecting more resources, then follow the directions below (keep in mind though that items you stored in treasure chests will still be there!):
- [*:3rz1ijbd]Open level.dat in NBTedit again.
[*:3rz1ijbd]You'll notice the file is much more robust now. We gave Minecraft just enough data to fix the rest of the file on it's own.
[*:3rz1ijbd]Expand the Inventory list.
[*:3rz1ijbd]Each item in here represents something in your inventory. You will have one item; the dirt you collected previously. Expand it. It has 4 data points. They are as follows:
[*:3rz1ijbd] Highlight the item block (not inventory, but just the one item)
[*:3rz1ijbd] Highlight the Inventory list
[*:3rz1ijbd] Now we have two dirt items. Who wants dirt though? You need to change the values as such:
- [*:3rz1ijbd]id: This is the id of the item within the game. change this to the id of the item you want. you can get the ids here: http://www.minecraft...iki/Data_values. Use the decimal values, not the hex ones
[*:3rz1ijbd]Damage: I advise keeping this 0 unless you are hell bent on giving yourself damaged items.
[*:3rz1ijbd]Slot: A number between 0 and 35 defining where in your inventory the item lives. The important thing is to make sure you do not use the same slot twice!
[*:3rz1ijbd]Count: How many of this item you have. 64 is max. A funny thing about using this editor is that you can assign a high count to items that normally have only 1 per slot restrictions (like minecarts). Don't think of it as cheating, think of it as a little bonus for going through this BS because of this massive corruption bug.
Well there you have it. Not all is lost! I hope this helps others who freaked out like I did when my world turned up empty. I suppose as a game in Alpha, fixes like this must be expected.
UPDATE: It appears that the forums will not play nice with my file uploads, so unfortunately, you will need to manually create the vanilla level.dat file as I have described it above. Use the information @ http://www.minecraft...evel.dat_Format to get the data types of the variables defined above (and of some other stuff I left out not pertaining to level recovery).