Interface SyncedData<T>
- Type Parameters:
T- The type of data being synced.
- All Superinterfaces:
Data<T>
- All Known Implementing Classes:
SyncedAutoSaveData,SyncedWorldSaveData
Represents an object holding a piece of data that will be automatically synced to the client.
Synchronised using the utility class, Synchronisation.
-
Method Summary
Modifier and TypeMethodDescriptionGet the data synced over from the server.net.minecraft.util.IdentifierUsed to get the id of this object.voidsetSyncedData(T clientData) Set the data synced from the server.default voidsync()Used the sync data to all clients.default voidsync(net.minecraft.server.network.ServerPlayerEntity client) Used the sync data to a client.
-
Method Details
-
getSyncedData
Get the data synced over from the server.- Returns:
- The synced data.
-
setSyncedData
Set the data synced from the server. Please don't use this, it should only be called by CoreLib during data synchronisation.- Parameters:
clientData- The new data
-
sync
@AvailableSince("1.0.0") default void sync()Used the sync data to all clients. -
sync
@AvailableSince("1.0.0") default void sync(net.minecraft.server.network.ServerPlayerEntity client) Used the sync data to a client.- Parameters:
client- The client to sync.
-
getSyncId
@AvailableSince("1.0.0") net.minecraft.util.Identifier getSyncId()Used to get the id of this object.- Returns:
- The object's id.
-