All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hohserg.elegant.networking.api.ElegantNetworking Maven / Gradle / Ivy

The newest version!
package hohserg.elegant.networking.api;

import hohserg.elegant.networking.impl.ISerializerBase;
import hohserg.elegant.networking.impl.Registry;

public class ElegantNetworking {
    /**
     * Gives a serializer for requested type.
     * Serializer generally is pair of functions:
     *
     * {@code A => ByteBuf }
     * {@code ByteBuf => A }
     *
     * @param           requested type
     * @param serializable class of requested type
     * @return serializer
     */
    public static  ISerializerBase getByteBufSerializerFor(Class serializable) {
        return Registry.getSerializerFor(serializable);
    }

    public static  NbtSerializer getNbtSerializerFor(Class serializable) {
        ISerializerBase serializer = getByteBufSerializerFor(serializable);
        return new NbtSerializer<>(serializer);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy