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 revisionBoth sides next revision
tutorial:persistent_states [2023/09/28 05:52] – Dropped un-needed DataFixType parameter and made type singleton jmanc3tutorial:persistent_states [2024/01/11 06:19] – Added link to AuthMe jmanc3
Line 541: Line 541:
 Running the client now, all our player-specific data is correctly saved. Running the client now, all our player-specific data is correctly saved.
  
-  Note: each time you restart the minecraft client with fabric, you're assigned a new UUID, so it may seem like it'not working, but that's just because of the developer environment. (If you run the fabric multiplayer server, 'Minecraft Server' and use authme, you could verify it does indeed work as it's supposed to.)+==== 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's 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.)
  
 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 646: Line 648:
   * Note: The ''**playerData**'' we created isn't the up-to-date one that lives on the server. We simply create our own copy of ''**PlayerData**'' client-side and update it as we receive packets. Since it's ''**public static**'' that means you can access it from anywhere on the client.   * Note: The ''**playerData**'' we created isn't the up-to-date one that lives on the server. We simply create our own copy of ''**PlayerData**'' client-side and update it as we receive packets. Since it's ''**public static**'' that means you can access it from anywhere on the client.
  
-  Note: each time you restart the minecraft client with fabric, you're assigned a new UUID, so it may seem like it'not working, but that's just because of the developer environment. (If you run the fabric multiplayer server, 'Minecraft Server' and use authme, you could verify it does indeed work as it's supposed to.)+==== 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's 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.)
  
 ====== More Involved Player Data ====== ====== More Involved Player Data ======
tutorial/persistent_states.txt · Last modified: 2024/04/25 14:06 by mayaqq