Jump to content

Saving GUI Options After Exit


minecraftbigfoot

Recommended Posts

So, I have set up a "digital" compass in my mod.

When you shift+right click it opens a GUI which you can use to turn it on or off.

It is on then I have a renderer that pops at the top of the screen "DIRECTION_FACING" (being one of the four directions).

 

The question I have is once it is turned on, I can put it in a chest and it will stay on, however once you leave game and rejoin you have to turn it on again. Is it possible to set it up so that if it is turned on its saved "on?" 

I feel like maybe nbt could do it? I'm not experienced with nbt at all so any help is great! Thank you :P

Link to comment
Share on other sites

So, the player activates your item and then something is added to the player's overlay display that shows their direction, even when they put the item down? (just checking I understand your aim)

 

To make it work consistently, you will need to store the information in the player (using a capability). Otherwise, what happens if one player activates a compass and another doesn't? Currently, you're storing the state in a static field in your item class so it will apply the same thing to all players no matter what.

  • Like 1
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.