How can I change my gamemode while not currently playing the game?

I fell in lava with all my good stuff and was nearly about to die. I was really disappointed, and didn't want to lose my equipment, so I quit the game just before I died.

Now, I would like to change my gamemode to Creative, but if I rejoin the world, I'll die before being able to type in the command. Is there a way to set my gamemode from outside the game? I suspect that what I’m looking for will be in the world saves folder or something. “Open to LAN” is not an option, it almost killed me.


You can modify your player.dat file to change your gamemode.

For this you'll need an NBT editor which can edit Minecraft's .dat files. I recommend NBTExplorer for this. It's available for both Windows and Mac.

Download and install NBTExplorer (or your editor of choice but I'm writing this with the assumption of NBTExplorer) and locate your player.dat file. This may be in the level.dat file of your world instead so if you're playing a singleplayer world check there first as it will override any player.dat files it finds. If it's in the level.dat file look for a tag called "Player" and expand it out. You're looking for a tag under that called "playerGameType". Set that to 1 for creative mode. (For completeness 0 is Survival, 1 is Creative, 2 is Adventure, and 3 is Spectator.)


You're going into creative mode anyways. The simpler solution would be to remake your gear in creative and replicate your inventory you had at the time. As far as I know, it is not possible to change your or another player's gamemode when not inside of the game.