Class IndexedMessageCodec
- java.lang.Object
-
- net.minecraftforge.fml.network.simple.IndexedMessageCodec
-
public class IndexedMessageCodec extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
IndexedMessageCodec.MessageHandler<MSG>
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description IndexedMessageCodec()
IndexedMessageCodec(NetworkInstance instance)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
SIMPLENET
private static final org.apache.logging.log4j.Marker SIMPLENET
-
indicies
private final it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap<IndexedMessageCodec.MessageHandler<?>> indicies
-
types
private final it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<java.lang.Class<?>,IndexedMessageCodec.MessageHandler<?>> types
-
networkInstance
private final NetworkInstance networkInstance
-
-
Constructor Detail
-
IndexedMessageCodec
public IndexedMessageCodec()
-
IndexedMessageCodec
public IndexedMessageCodec(NetworkInstance instance)
-
-
Method Detail
-
findMessageType
public <MSG> IndexedMessageCodec.MessageHandler<MSG> findMessageType(MSG msgToReply)
-
findIndex
<MSG> IndexedMessageCodec.MessageHandler<MSG> findIndex(short i)
-
tryDecode
private static <M> void tryDecode(PacketBuffer payload, java.util.function.Supplier<NetworkEvent.Context> context, int payloadIndex, IndexedMessageCodec.MessageHandler<M> codec)
-
tryEncode
private static <M> int tryEncode(PacketBuffer target, M message, IndexedMessageCodec.MessageHandler<M> codec)
-
build
public <MSG> int build(MSG message, PacketBuffer target)
-
consume
void consume(PacketBuffer payload, int payloadIndex, java.util.function.Supplier<NetworkEvent.Context> context)
-
addCodecIndex
<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)
-
-