public class IndexedMessageCodec
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
IndexedMessageCodec.MessageHandler<MSG> |
Modifier and Type | Field and Description |
---|---|
private it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap<IndexedMessageCodec.MessageHandler<?>> |
indicies |
private static org.apache.logging.log4j.Logger |
LOGGER |
private NetworkInstance |
networkInstance |
private static org.apache.logging.log4j.Marker |
SIMPLENET |
private it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<java.lang.Class<?>,IndexedMessageCodec.MessageHandler<?>> |
types |
Constructor and Description |
---|
IndexedMessageCodec() |
IndexedMessageCodec(NetworkInstance instance) |
Modifier and Type | Method and Description |
---|---|
(package private) <MSG> IndexedMessageCodec.MessageHandler<MSG> |
addCodecIndex(int index,
java.lang.Class<MSG> messageType,
java.util.function.BiConsumer<MSG,PacketBuffer> encoder,
java.util.function.Function<PacketBuffer,MSG> decoder,
java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer,
java.util.Optional<NetworkDirection> networkDirection) |
<MSG> int |
build(MSG message,
PacketBuffer target) |
(package private) void |
consume(PacketBuffer payload,
int payloadIndex,
java.util.function.Supplier<NetworkEvent.Context> context) |
(package private) <MSG> IndexedMessageCodec.MessageHandler<MSG> |
findIndex(short i) |
<MSG> IndexedMessageCodec.MessageHandler<MSG> |
findMessageType(MSG msgToReply) |
private static <M> void |
tryDecode(PacketBuffer payload,
java.util.function.Supplier<NetworkEvent.Context> context,
int payloadIndex,
IndexedMessageCodec.MessageHandler<M> codec) |
private static <M> int |
tryEncode(PacketBuffer target,
M message,
IndexedMessageCodec.MessageHandler<M> codec) |
private static final org.apache.logging.log4j.Logger LOGGER
private static final org.apache.logging.log4j.Marker SIMPLENET
private final it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap<IndexedMessageCodec.MessageHandler<?>> indicies
private final it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<java.lang.Class<?>,IndexedMessageCodec.MessageHandler<?>> types
private final NetworkInstance networkInstance
public IndexedMessageCodec()
public IndexedMessageCodec(NetworkInstance instance)
public <MSG> IndexedMessageCodec.MessageHandler<MSG> findMessageType(MSG msgToReply)
<MSG> IndexedMessageCodec.MessageHandler<MSG> findIndex(short i)
private static <M> void tryDecode(PacketBuffer payload, java.util.function.Supplier<NetworkEvent.Context> context, int payloadIndex, IndexedMessageCodec.MessageHandler<M> codec)
private static <M> int tryEncode(PacketBuffer target, M message, IndexedMessageCodec.MessageHandler<M> codec)
public <MSG> int build(MSG message, PacketBuffer target)
void consume(PacketBuffer payload, int payloadIndex, java.util.function.Supplier<NetworkEvent.Context> context)
<MSG> IndexedMessageCodec.MessageHandler<MSG> addCodecIndex(int index, java.lang.Class<MSG> messageType, java.util.function.BiConsumer<MSG,PacketBuffer> encoder, java.util.function.Function<PacketBuffer,MSG> decoder, java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer, java.util.Optional<NetworkDirection> networkDirection)