hohserg.elegant.networking.api.ElegantNetworking Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elegant-networking-1.7.10 Show documentation
Show all versions of elegant-networking-1.7.10 Show documentation
This is a runtime library of ElegantNetworking for MinecraftForge 1.7.10
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);
}
}