Jump to content

[1.6.4]storing maps in nbt


Jdb100

Recommended Posts

I have a hash map that I want to store as nbt. I write on FMLServerStoppingEvent and read on FMLServerStartingEvent.

 

The hash map is as so:

Public static Map<String, Set<Research>> researchedByPlayer = new HashMap<String, Set<Research>>();

 

I have a method to get the name of the research as a string aswell as find the research by a string.

I thought of doing it by looping through the keys of the map and saving each as a string in nbt then doing the same for the values by iterating through the set and getting the name to save. I don't know how I and then just do the reverse for loading. Is this the correct way or should I do it a different way?

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.