Interface PayloadFlow<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload>
- All Superinterfaces:
BaseProtocol<PayloadFlow<BUF,
,BASE>, PayloadProtocol<BUF, BASE>> ChannelBuildable<CustomPacketPayload>
,PayloadConnection<BASE>
,PayloadProtocol<BUF,
BASE>
- All Known Implementing Classes:
PayloadChannel.Builder.Flow
public interface PayloadFlow<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload>
extends PayloadProtocol<BUF,BASE>, ChannelBuildable<CustomPacketPayload>
-
Method Summary
Modifier and TypeMethodDescription<MSG extends BASE>
PayloadFlow<BUF, BASE> add
(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> handler) Adds a packet to this channel that has it's protocol validated whenever sent or received.default <MSG extends BASE>
PayloadFlow<BUF, BASE> addMain
(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> handler) Adds a packet to this channel that has it's protocol validated whenever sent or received.Methods inherited from interface net.minecraftforge.network.simple.BaseProtocol
bidirectional, bidirectional, clientbound, clientbound, flow, flow, flow, serverbound, serverbound
Methods inherited from interface net.minecraftforge.network.ChannelBuildable
build
Methods inherited from interface net.minecraftforge.network.payload.PayloadConnection
any, any, any, any, configuration, configuration, configuration, configuration, login, login, login, login, play, play, play, play, protocol, protocol, protocol, protocol
-
Method Details
-
add
<MSG extends BASE> PayloadFlow<BUF,BASE> add(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> handler) Adds a packet to this channel that has it's protocol validated whenever sent or received.The handler is called on the network thread, and so should not interact with most game state by default.
CustomPayloadEvent.Context.enqueueWork(Runnable)
can be used to handle the message on the main server or client thread. -
addMain
default <MSG extends BASE> PayloadFlow<BUF,BASE> addMain(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> handler) Adds a packet to this channel that has it's protocol validated whenever sent or received.Unlike
invalid reference
#add(Class,StreamCodec,BiConsumer)
-