Jump to content

Is there a way to write to EntityPlayer NBT without editing base classes?


Pardeep

Recommended Posts

I want to create an integer variable and have it be read and written to NBT but to the EntityPlayer NBT so it saves for everytime you close and reopen minecraft but is also different for each world, and the NBT of EntityPlayer does that. However I want to do this without editing the class EntityPlayer or any base classes for that matter. Is this possible? If so how?

 

A further point is I'd like to do it from my base class or my proxy file. This would be great but if it can only be done from creating a separate class than I don't mind. Thanks in advance.

Link to comment
Share on other sites

This is very possible. If you have lots of data that you want to store, than you can make a class that implements IExtendedEntityProperties ( or something similar to that name ). Or you can use

NBTTagCompound playerNBT = playerInstance.somethingToGetNBT();

playerNBT.setInteger( "MyIntegerForSomethingToBeStored", myIntegerToBeStored );

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 xD

Link to comment
Share on other sites

Thank you. I will look into these tomorrow and get back to you as to if they worked (they probably do anyway)

 

There are a few extra things with the interfacing way, with the NBTTagCompound straight from the player... I haven't really done that.

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 xD

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.