Interface SyncedData<T>

Type Parameters:
T - The type of data being synced.
All Superinterfaces:
Data<T>
All Known Implementing Classes:
SyncedAutoSaveData, SyncedWorldSaveData

@AvailableSince("1.0.0") public interface SyncedData<T> extends Data<T>
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 Type
    Method
    Description
    Get the data synced over from the server.
    net.minecraft.util.Identifier
    Used to get the id of this object.
    void
    setSyncedData(T clientData)
    Set the data synced from the server.
    default void
    Used the sync data to all clients.
    default void
    sync(net.minecraft.server.network.ServerPlayerEntity client)
    Used the sync data to a client.

    Methods inherited from interface dev.scsupercraft.mc.libraries.corelib.api.data.Data

    getData, setData
  • Method Details

    • getSyncedData

      @AvailableSince("1.0.0") T getSyncedData()
      Get the data synced over from the server.
      Returns:
      The synced data.
    • setSyncedData

      @AvailableSince("1.0.0") void setSyncedData(T clientData)
      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.