zerozhou Posted November 21, 2013 Share Posted November 21, 2013 I've try to record something about the player with NBT, like level or something like that. But when the player dead, and respawn, all the record seems to be clear. I want to keep the information of the player after his death. Which code should I check for? Quote Link to comment Share on other sites More sharing options...
hydroflame Posted November 21, 2013 Share Posted November 21, 2013 check for IExtendedEntityProperties Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution- Link to comment Share on other sites More sharing options...
Mazetar Posted November 21, 2013 Share Posted November 21, 2013 As I recall information in the players IExtendedProperties also are wiped upon death. Since we are talking about storage of information for use during runtime, you could just store the information anywhere you want between his death and his respawn. Isn't that a simple solution? Never forget that despite the number of weird things that goes on in Minecraft's code; it's still just Java Quote If you guys dont get it.. then well ya.. try harder... Link to comment Share on other sites More sharing options...
zerozhou Posted November 21, 2013 Author Share Posted November 21, 2013 Maybe I found how to do this with forge as I found a code like this in EntityPlayer //Copy over a section of the Entity Data from the old player. //Allows mods to specify data that persists after players respawn. NBTTagCompound old = par1EntityPlayer.getEntityData(); if (old.hasKey(PERSISTED_NBT_TAG)) { getEntityData().setCompoundTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); } Which would be called when the player is respawn. It seems that I need to record the data with the key PERSISTED_NBT_TAG and add a new NBT node here. Am I right? Quote Link to comment Share on other sites More sharing options...
GotoLink Posted November 21, 2013 Share Posted November 21, 2013 Yes, you can write on the NBT which is stored on the "persisted tag" key. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.