接口 ICommonPacketListener
- 所有超级接口:
PacketListener
- 所有已知子接口:
ClientCommonPacketListener
,ClientConfigurationPacketListener
,ClientGamePacketListener
,IClientCommonPacketListenerExtension
,IServerCommonPacketListenerExtension
,IServerConfigurationPacketListenerExtension
,IServerGamePacketListenerExtension
,ServerCommonPacketListener
,ServerConfigurationPacketListener
,ServerGamePacketListener
- 所有已知实现类:
FakePlayer.FakePlayerNetHandler
,ServerCommonPacketListenerImpl
,ServerConfigurationPacketListenerImpl
,ServerGamePacketListenerImpl
Extension interface and functionality hoist for both
ServerCommonPacketListener
and ClientCommonPacketListener
.-
方法概要
修饰符和类型方法说明void
disconnect
(Component reason) Triggers a disconnection with the given reason.返回 the connection this listener is attached to。返回 the connection type of this packet listener。返回 the main thread event loop。default boolean
hasChannel
(CustomPacketPayload payload) default boolean
hasChannel
(CustomPacketPayload.Type<?> type) default boolean
hasChannel
(ResourceLocation payloadId) Checks if the connection has negotiated and opened a channel for the payload.void
send
(CustomPacketPayload payload) Sends a payload to the target of this listener.void
Sends a packet to the target of this listener.从接口继承的方法 net.minecraft.network.PacketListener
createDisconnectionInfo, fillCrashReport, fillListenerSpecificCrashDetails, flow, isAcceptingMessages, onDisconnect, onPacketError, protocol, shouldHandleMessage
-
方法详细资料
-
send
Sends a packet to the target of this listener. -
send
Sends a payload to the target of this listener. -
disconnect
Triggers a disconnection with the given reason.- 参数:
reason
- The reason for the disconnection
-
getConnection
Connection getConnection()返回 the connection this listener is attached to。- 返回:
- the connection this listener is attached to
-
getMainThreadEventLoop
ReentrantBlockableEventLoop<?> getMainThreadEventLoop()返回 the main thread event loop。- 返回:
- the main thread event loop
-
hasChannel
Checks if the connection has negotiated and opened a channel for the payload.- 参数:
payloadId
- The payload id to check
-
hasChannel
-
hasChannel
-
getConnectionType
ConnectionType getConnectionType()返回 the connection type of this packet listener。- 返回:
- the connection type of this packet listener
-