接口 SimpleHandlerFlow<BUF extends FriendlyByteBuf,BASE>
- 所有超级接口:
BaseProtocol<SimpleHandlerFlow<BUF,
,BASE>, SimpleHandlerProtocol<BUF, BASE>> ChannelBuildable<Object>
,SimpleBuildable
,SimpleConnection<BASE>
,SimpleHandlerProtocol<BUF,
BASE>
- 所有已知实现类:
SimpleChannel.HandlerFlow
public interface SimpleHandlerFlow<BUF extends FriendlyByteBuf,BASE>
extends SimpleHandlerProtocol<BUF,BASE>, SimpleBuildable
-
方法概要
修饰符和类型方法说明<MSG extends BASE>
SimpleHandlerFlow<BUF, BASE> add
(Class<MSG> type, StreamCodec<BUF, MSG> codec) Adds a packet to this channel that has it's protocol validated whenever sent or received.<MSG extends BASE>
SimpleHandlerFlow<BUF, BASE> add
(Class<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.<MSG extends BASE>
SimpleHandlerFlow<BUF, BASE> addMain
(Class<MSG> type, StreamCodec<BUF, MSG> codec) Adds a packet to this channel that has it's protocol validated whenever sent or received.从接口继承的方法 net.minecraftforge.network.simple.BaseProtocol
bidirectional, bidirectional, clientbound, clientbound, flow, flow, flow, serverbound, serverbound
从接口继承的方法 net.minecraftforge.network.simple.SimpleBuildable
build
从接口继承的方法 net.minecraftforge.network.simple.SimpleConnection
any, any, any, any, configuration, configuration, configuration, configuration, login, login, login, login, play, play, play, play, protocol, protocol, protocol, protocol
-
方法详细资料
-
add
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. Alternatively one can useaddMain(Class, StreamCodec)
to run the handler on the main thread. -
addMain
Adds a packet to this channel that has it's protocol validated whenever sent or received.Unlike
add(Class,StreamCodec)
, the consumer is called on the main thread, and so can interact with most game state by default. -
add
<MSG extends BASE> SimpleHandlerFlow<BUF,BASE> add(Class<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.
-