Package net.minecraft.network.listener
Interface PacketListener
- All Known Subinterfaces:
ClientLoginPacketListener
,ClientPlayPacketListener
,ClientQueryPacketListener
,ServerHandshakePacketListener
,ServerLoginPacketListener
,ServerPacketListener
,ServerPlayPacketListener
,ServerQueryPacketListener
,TickablePacketListener
- All Known Implementing Classes:
ClientLoginNetworkHandler
,ClientPlayNetworkHandler
,LocalServerHandshakeNetworkHandler
,ServerHandshakeNetworkHandler
,ServerLoginNetworkHandler
,ServerPlayNetworkHandler
,ServerQueryNetworkHandler
public interface PacketListener
A packet listener listens to packets on a connection.
Its listener methods will be called on the netty event loop than the client or server game engine threads.
- Mappings:
Namespace Name official sk
intermediary net/minecraft/class_2547
named net/minecraft/network/listener/PacketListener
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
onDisconnected
(Text reason) Called when the connection this listener listens to has disconnected.default boolean
Returns whether uncaught exceptions in main thread should crash the game instead of logging and ignoring them.
-
Method Details
-
onDisconnected
Called when the connection this listener listens to has disconnected. Can be used to display the disconnection reason.- Parameters:
reason
- the reason of disconnection; may be a generic message- Mappings:
Namespace Name Mixin selector official a
Lsk;a(Lsw;)V
intermediary method_10839
Lnet/minecraft/class_2547;method_10839(Lnet/minecraft/class_2561;)V
named onDisconnected
Lnet/minecraft/network/listener/PacketListener;onDisconnected(Lnet/minecraft/text/Text;)V
-
isConnectionOpen
boolean isConnectionOpen()- Mappings:
Namespace Name Mixin selector official a
Lsk;a()Z
intermediary method_48106
Lnet/minecraft/class_2547;method_48106()Z
named isConnectionOpen
Lnet/minecraft/network/listener/PacketListener;isConnectionOpen()Z
-
shouldCrashOnException
default boolean shouldCrashOnException()Returns whether uncaught exceptions in main thread should crash the game instead of logging and ignoring them.- Returns:
- whether uncaught exceptions in main thread should crash the game instead of logging and ignoring them
- See Also:
- API Note:
- This only affects the processing on the main thread done by calling
methods in
NetworkThreadUtils
. Uncaught exceptions in other threads or processing in the main thread using theclient.execute(() -> {})
code will be unaffected, and always gets logged without crashing. - Implementation Note:
- This is
true
by default. - Mappings:
Namespace Name Mixin selector official b
Lsk;b()Z
intermediary method_40065
Lnet/minecraft/class_2547;method_40065()Z
named shouldCrashOnException
Lnet/minecraft/network/listener/PacketListener;shouldCrashOnException()Z
-