Posted June 15, 201312 yr For the mod I'm making, I need to know how to save extra data to the player. Is there a way for me to do it with NBT data? I'm going to need to save 3 integers and a byte. If anyone knows how I can do this, please let me know. If I need to save it to a custom external file, how would I set up the directory for the file? I already know how to save and read from external files.
June 15, 201312 yr Assuming you have an instance of EntityPlayer (we'll call this 'player'), you can use player.getEntityData() and do whatever you need to there.
June 15, 201312 yr Author it always says zero. it should say 100 but it doesn't. The latest commit on the github has all the changes that were made, so here. https://github.com/code-lyoko-modding/CodeLyokoMod/commit/105e5f010864436fc397648adbeab71496e5577a
June 15, 201312 yr By default, getting an object from an NBTTagCompound will return 0 if the key doesn't exist. You might try using hasKey checks. I haven't had any problems with this before, so here's what I would do: if(player.getEntityData().hasKey("lifePoints")) { //do stuff }
June 15, 201312 yr Author Never Mind. I figured out how to add an stuff to NBT, but it still doesn't show up. latest commit. https://github.com/code-lyoko-modding/CodeLyokoMod/commit/34b00755699bc74678efc74bfbfbe216f98066bb
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.