Class ClientSessionData
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.SessionData
net.neoforged.neoforge.client.attachment.ClientSessionData
- All Implemented Interfaces:
IAttachmentHolder
Session data for the client.
Persistent attachments that aren't synced are saved by the client using a per-(world/server/lan-world) path. Synced attachments are server authoritative and are never saved on the client.
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final Pathprivate static final intprivate static final org.slf4j.Loggerprivate static final int(package private) static final Stringprivate final RegistryAccessprivate static final int(package private) static final Stringprivate intFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClientSessionDatacreate(Minecraft minecraft, ClientPacketListener listener) voidload()private ProblemReporter.PathElementstatic PathresolveFile(Path gameDirectory, @Nullable IntegratedServer singleplayerServer, @Nullable ServerData serverData) World file for the singleplayer host, game directory file keyed by server otherwise.voidsave()static StringstorageKey(ServerData serverData) Realms and LAN games have no stable address, so they are keyed by name instead.voidtick()Methods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachments, setDataMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData, syncData
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
SAVE_INTERVAL_TICKS
private static final int SAVE_INTERVAL_TICKS- See Also:
-
DATA_KEY
- See Also:
-
MAX_KEY_LENGTH
private static final int MAX_KEY_LENGTH- See Also:
-
HASH_LENGTH
private static final int HASH_LENGTH- See Also:
-
SINGLEPLAYER_FILE
- See Also:
-
MULTIPLAYER_DIR
- See Also:
-
registryAccess
-
file
-
ticksUntilSave
private int ticksUntilSave
-
-
Constructor Details
-
ClientSessionData
-
-
Method Details
-
create
-
resolveFile
public static Path resolveFile(Path gameDirectory, @Nullable IntegratedServer singleplayerServer, @Nullable ServerData serverData) World file for the singleplayer host, game directory file keyed by server otherwise.- Throws:
IllegalStateException- If neither the integrated server nor the server data are provided.
-
storageKey
Realms and LAN games have no stable address, so they are keyed by name instead. Keys do not survive renames or host IP changes, and a server transfer keeps the origin server's key. Keys longer than 64 characters are clamped and suffixed with a hash of the original key. -
load
public void load() -
save
public void save() -
tick
public void tick() -
problemPath
-