User Tools

Site Tools


tutorial:persistent_states

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorial:persistent_states [2024/01/11 06:19] – Added link to AuthMe jmanc3tutorial:persistent_states [2024/01/11 06:44] – typo jmanc3
Line 543: Line 543:
 ==== Important Caveat ==== ==== Important Caveat ====
  
-  * Each time you restart the minecraft client with fabric, you're assigned a new UUID, so it may seem like our code is not working, but that'just because of the developer environment(If you run the fabric multiplayer server'Minecraft Server' and use [[https://www.curseforge.com/minecraft/mc-mods/auth-me|AuthMe]] so that you get the same UUID every launch, you could verify it does indeed work as it's supposed to.)+  * Each time you restart the minecraft client with fabric, you're assigned a new random UUID each launch, so it may seem like our code is not working because it'pulling data for a new UUID never before seen. If you want to verify everything is working correctlydownload [[https://www.curseforge.com/minecraft/mc-mods/auth-me|AuthMe]] and drop the ''AuthMe.jar'' into run/mods. Login to your Minecraft account from the multiplayer screen. This will now change the random UUID to your actual UUID and therefore you can test if the data is correctly saved and associated with one UUID even across restarts. (You don't have to keep doing thisonce you've verified once that, if the UUID is the same across launches, the data is correctly saved, you can just develop the mod normally safe in the knowledge that your data will be saved)
  
 Just remember if you add new fields to ''**PlayerData**'' or ''**StateSaveAndLoader**'' you need to correctly do the work of writing and loading those fields in the ''**writeNbt**'' and ''**createFromNbt**'' functions //always//. If you forget this step, your data won't be properly saved or loaded from disk. Just remember if you add new fields to ''**PlayerData**'' or ''**StateSaveAndLoader**'' you need to correctly do the work of writing and loading those fields in the ''**writeNbt**'' and ''**createFromNbt**'' functions //always//. If you forget this step, your data won't be properly saved or loaded from disk.
Line 650: Line 650:
 ==== Important Caveat ==== ==== Important Caveat ====
  
-  * Each time you restart the minecraft client with fabric, you're assigned a new UUID, so it may seem like our code is not working, but that'just because of the developer environment(If you run the fabric multiplayer server'Minecraft Server' and use [[https://www.curseforge.com/minecraft/mc-mods/auth-me|AuthMe]] so that you get the same UUID every launch, you could verify it does indeed work as it's supposed to.)+  * Each time you restart the minecraft client with fabric, you're assigned a new random UUID each launch, so it may seem like our code is not working because it'pulling data for a new UUID never before seen. If you want to verify everything is working correctlydownload [[https://www.curseforge.com/minecraft/mc-mods/auth-me|AuthMe]] and drop the ''AuthMe.jar'' into run/mods. Login to your Minecraft account from the multiplayer screen. This will now change the random UUID to your actual UUID and therefore you can test if the data is correctly saved and associated with one UUID even across restarts. (You don't have to keep doing thisonce you've verified once that, if the UUID is the same across launches, the data is correctly saved, you can just develop the mod normally safe in the knowledge that your data will be saved)
  
 ====== More Involved Player Data ====== ====== More Involved Player Data ======
tutorial/persistent_states.txt · Last modified: 2024/04/25 14:06 by mayaqq