Class IndexedMessageCodec
java.lang.Object
net.minecraftforge.network.simple.IndexedMessageCodec
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap<IndexedMessageCodec.MessageHandler<?>>
private static final org.apache.logging.log4j.Logger
private final NetworkInstance
private static final org.apache.logging.log4j.Marker
private final it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<Class<?>,
IndexedMessageCodec.MessageHandler<?>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) <MSG> IndexedMessageCodec.MessageHandler<MSG>
addCodecIndex
(int index, Class<MSG> messageType, BiConsumer<MSG, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, MSG> decoder, BiConsumer<MSG, Supplier<NetworkEvent.Context>> messageConsumer, Optional<NetworkDirection> networkDirection) <MSG> int
build
(MSG message, FriendlyByteBuf target) (package private) void
consume
(FriendlyByteBuf payload, int payloadIndex, 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
(FriendlyByteBuf payload, Supplier<NetworkEvent.Context> context, int payloadIndex, IndexedMessageCodec.MessageHandler<M> codec) private static <M> int
tryEncode
(FriendlyByteBuf target, M message, IndexedMessageCodec.MessageHandler<M> codec)
-
Field Details
-
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<Class<?>,IndexedMessageCodec.MessageHandler<?>> types -
networkInstance
-
-
Constructor Details
-
IndexedMessageCodec
public IndexedMessageCodec() -
IndexedMessageCodec
-
-
Method Details
-
findMessageType
-
findIndex
-
tryDecode
private static <M> void tryDecode(FriendlyByteBuf payload, Supplier<NetworkEvent.Context> context, int payloadIndex, IndexedMessageCodec.MessageHandler<M> codec) -
tryEncode
private static <M> int tryEncode(FriendlyByteBuf target, M message, IndexedMessageCodec.MessageHandler<M> codec) -
build
-
consume
-
addCodecIndex
<MSG> IndexedMessageCodec.MessageHandler<MSG> addCodecIndex(int index, Class<MSG> messageType, BiConsumer<MSG, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, MSG> decoder, BiConsumer<MSG, Supplier<NetworkEvent.Context>> messageConsumer, Optional<NetworkDirection> networkDirection)
-