T - the generic typeS - the generic typepublic interface ISyncHandler<T,S extends ISyncableData>
ISyncHandler are used to define handlers for the Syncer.Syncer.registerHandlerFactory(String, com.google.common.base.Supplier).| Modifier and Type | Method and Description |
|---|---|
void |
addObjectData(ObjectData objectData)
Adds a
ObjectData to be handled by this ISyncHandler. |
java.lang.String |
getName()
Gets the name of this
ISyncHandler. |
ObjectData |
getObjectData(int index)
Gets the
ObjectData for the specified index (called from the the SyncerMessage.Packet). |
ObjectData |
getObjectData(java.lang.String name)
Gets the
ObjectData from its name. |
T |
getReceiver(net.minecraftforge.fml.common.network.simpleimpl.MessageContext ctx,
S data)
Gets the object to be synced on the receiving side.
|
S |
getSyncData(T caller)
Gets the
ISyncableData that holds the extra data to be sent. |
void |
send(T caller,
SyncerMessage.Packet<T,S> packet)
Sends the syncing packet.
|
java.lang.String getName()
ISyncHandler. That name needs to match the Syncable value for the class it's applied on.T getReceiver(net.minecraftforge.fml.common.network.simpleimpl.MessageContext ctx, S data)
ctx - the ctxdata - the dataS getSyncData(T caller)
ISyncableData that holds the extra data to be sent.ISyncableData.fromBytes(io.netty.buffer.ByteBuf)caller - the callervoid addObjectData(ObjectData objectData)
ObjectData to be handled by this ISyncHandler.objectData - the field dataObjectData getObjectData(int index)
ObjectData for the specified index (called from the the SyncerMessage.Packet).index - the indexObjectData getObjectData(java.lang.String name)
ObjectData from its name.name - the namevoid send(T caller, SyncerMessage.Packet<T,S> packet)
caller - the callerpacket - the packet