better naming for client/server only handlers

This commit is contained in:
Frank 2021-08-17 12:56:37 +02:00
parent 29fe59b4b9
commit 55f00c664c
11 changed files with 341 additions and 130 deletions

View file

@ -42,6 +42,15 @@ public class DataExchangeAPI extends DataExchange {
if (!MODS.contains(modID)) MODS.add(modID);
}
/**
* Register a mod dependency to participate in the DataExchange.
*
* @param modID - {@link String} modID.
*/
public static void registerModDependency(String modID) {
registerMod(modID);
}
/**
* Returns the IDs of all registered Mods.
*
@ -79,12 +88,12 @@ public class DataExchangeAPI extends DataExchange {
* Depending on what the result of {@link DataHandler#getOriginatesOnServer()}, the Data is sent from the server
* to the client (if {@code true}) or the other way around.
* <p>
* The method {@link DataHandler#serializeData(FriendlyByteBuf)} is called just before the data is sent. You should
* The method {@link DataHandler#serializeData(FriendlyByteBuf, boolean)} is called just before the data is sent. You should
* use this method to add the Data you need to the communication.
*
* @param h The Data that you want to send
*/
public static void send(DataHandler h) {
public static void send(BaseDataHandler h) {
if (h.getOriginatesOnServer()) {
DataExchangeAPI.getInstance().server.sendToClient(h);
}