Posted September 1, 201312 yr I'm working on a mod to help myself and my friends with a playthrough that we have planned, but I've hit a roadblock with it. I am not very good with java and it's a miracle I've gotten this far. My Question: How can I load a player's .dat file, modify the health and position tags, and save it?
September 1, 201312 yr Changing the player dat file would only affect it if you do it before the player logs in. If you do it after, your saved data will be overwritten on player log out and won't come into effect at all. Make an external program for the client to run before he starts his game. Why do you want to change that data ?
September 1, 201312 yr Author It would be happening while the player is not logged in. I am making a mod that adds an item to bring back a dead player on a Hardcore server. I already managed to make it unban them, but am having trouble with restoring them to life.
September 2, 201312 yr That seems "illegal" to me... The fact that you are trying to revive someone on a PURPOSELY made hardcore server... That just goes against the purpose of the server. So I would suggest leaving that alone... And besides, the server would have to install the mod for it to actually work anyway, and if they are wanting to be a hardcore server, then they won't install your mod. Go figure. I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
September 2, 201312 yr Author I am no fool, I know that both client and server would require this mod. Does it not occur to you that maybe I am the one setting up the server? This Item is difficult to make. Having Hardcore this way does give some permanence to death, but allows your friends a way to bring you back. This is for a cooperative hardcore server, not a competitive one.
September 2, 201312 yr no mew its fine because server side knows whos dead and whos alive, a random player cant revive himself with this mod how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
September 2, 201312 yr no mew its fine because server side knows whos dead and whos alive, a random player cant revive himself with this mod Okay. Thanks for clearing that up I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
September 2, 201312 yr Author So now that we've established that I'm not doing anything evil, is there any chance of me actually getting help?
September 2, 201312 yr Examine their player.dat file, open it in java using a buffered reader and then write it back using a buffered writer with the modified exception. NOTE: I've never needed to look into the player.dat files so I don't know what you'd be looking for sorry. EDIT: Just looked into NBT and dat files, firstly the dat file is a GZIP file, with sub files, you'll have to unpack it to read and edit it. This is the actual data file stored withing the {playername}.dat <-- wouldn't let me c&p the text. you should see the variables of the palyer, this one has a few of the ones I've added too.. you can see the health section? that's what you have to edit somehow enjoy
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.