Class Synchronisation
java.lang.Object
dev.scsupercraft.mc.libraries.corelib.api.util.Synchronisation
A utility class for synchronising data.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidsetup(SyncedData<T> syncedData, CodecHolder<T> codecHolder) Set up an object for synchronisation.static voidsynchronise(SyncedData<?> syncedData) Synchronises the data to all clients.static voidsynchronise(SyncedData<?> syncedData, net.minecraft.server.network.ServerPlayerEntity client) Synchronises the data to the specified client.static voidsynchronise(net.minecraft.server.network.ServerPlayerEntity client) Synchronises all data to the specified client.
-
Method Details
-
setup
@AvailableSince("1.0.0") public static <T> void setup(SyncedData<T> syncedData, CodecHolder<T> codecHolder) Set up an object for synchronisation.Failing to call this method will result in errors upon trying to synchronise the data.
- Type Parameters:
T- The type of data being synchronised.- Parameters:
syncedData- The synced data to set up synchronisation for.codecHolder- The codec holder to use for serialisation.
-
synchronise
Synchronises the data to all clients.- Parameters:
syncedData- The data to synchronise.
-
synchronise
@AvailableSince("1.0.0") public static void synchronise(SyncedData<?> syncedData, net.minecraft.server.network.ServerPlayerEntity client) Synchronises the data to the specified client.- Parameters:
syncedData- The data to synchronise.client- The client to send the data to.
-
synchronise
@AvailableSince("1.0.0") public static void synchronise(net.minecraft.server.network.ServerPlayerEntity client) Synchronises all data to the specified client.- Parameters:
client- The client to send the data to.
-