Package net.minecraft.network.listener
Interface PacketListener
- All Known Subinterfaces:
ClientCommonPacketListener,ClientConfigurationPacketListener,ClientCookieRequestPacketListener,ClientLoginPacketListener,ClientPacketListener,ClientPingResultPacketListener,ClientPlayPacketListener,ClientQueryPacketListener,ServerCommonPacketListener,ServerConfigurationPacketListener,ServerCookieResponsePacketListener,ServerCrashSafePacketListener,ServerHandshakePacketListener,ServerLoginPacketListener,ServerPacketListener,ServerPlayPacketListener,ServerQueryPacketListener,ServerQueryPingPacketListener,TickablePacketListener
- All Known Implementing Classes:
ClientCommonNetworkHandler,ClientConfigurationNetworkHandler,ClientLoginNetworkHandler,ClientPlayNetworkHandler,LocalServerHandshakeNetworkHandler,ServerCommonNetworkHandler,ServerConfigurationNetworkHandler,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 named net/minecraft/network/listener/PacketListenerintermediary net/minecraft/class_2547official wr
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleandefault voiddefault voidfillCrashReport(CrashReport report) getPhase()getSide()booleanvoidonDisconnected(Text reason) Called when the connection this listener listens to has disconnected.default booleanReturns whether uncaught exceptions in main thread should crash the game instead of logging and ignoring them.
-
Method Details
-
getSide
NetworkSide getSide()- Mappings:
Namespace Name Mixin selector named getSideLnet/minecraft/network/listener/PacketListener;getSide()Lnet/minecraft/network/NetworkSide;intermediary method_52895Lnet/minecraft/class_2547;method_52895()Lnet/minecraft/class_2598;official aLwr;a()Lzt;
-
getPhase
NetworkPhase getPhase()- Mappings:
Namespace Name Mixin selector named getPhaseLnet/minecraft/network/listener/PacketListener;getPhase()Lnet/minecraft/network/NetworkPhase;intermediary method_52280Lnet/minecraft/class_2547;method_52280()Lnet/minecraft/class_2539;official bLwr;b()Lwk;
-
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 named onDisconnectedLnet/minecraft/network/listener/PacketListener;onDisconnected(Lnet/minecraft/text/Text;)Vintermediary method_10839Lnet/minecraft/class_2547;method_10839(Lnet/minecraft/class_2561;)Vofficial aLwr;a(Lxl;)V
-
isConnectionOpen
boolean isConnectionOpen()- Mappings:
Namespace Name Mixin selector named isConnectionOpenLnet/minecraft/network/listener/PacketListener;isConnectionOpen()Zintermediary method_48106Lnet/minecraft/class_2547;method_48106()Zofficial cLwr;c()Z
-
accepts
- Mappings:
Namespace Name Mixin selector named acceptsLnet/minecraft/network/listener/PacketListener;accepts(Lnet/minecraft/network/packet/Packet;)Zintermediary method_52413Lnet/minecraft/class_2547;method_52413(Lnet/minecraft/class_2596;)Zofficial aLwr;a(Lzs;)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
trueby default. - Mappings:
Namespace Name Mixin selector named shouldCrashOnExceptionLnet/minecraft/network/listener/PacketListener;shouldCrashOnException()Zintermediary method_40065Lnet/minecraft/class_2547;method_40065()Zofficial dLwr;d()Z
-
fillCrashReport
- Mappings:
Namespace Name Mixin selector named fillCrashReportLnet/minecraft/network/listener/PacketListener;fillCrashReport(Lnet/minecraft/util/crash/CrashReport;)Vintermediary method_55622Lnet/minecraft/class_2547;method_55622(Lnet/minecraft/class_128;)Vofficial aLwr;a(Lo;)V
-
addCustomCrashReportInfo
- Mappings:
Namespace Name Mixin selector named addCustomCrashReportInfoLnet/minecraft/network/listener/PacketListener;addCustomCrashReportInfo(Lnet/minecraft/util/crash/CrashReportSection;)Vintermediary method_55597Lnet/minecraft/class_2547;method_55597(Lnet/minecraft/class_129;)Vofficial aLwr;a(Lp;)V
-