Class PacketUtils
java.lang.Object
net.minecraft.network.protocol.PacketUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends PacketListener>
voidensureRunningOnSameThread(Packet<T> packet, T listener, PacketProcessor packetProcessor) static <T extends PacketListener>
voidensureRunningOnSameThread(Packet<T> packet, T listener, ServerLevel level) Ensures that the given packet is handled on the main thread.static <T extends PacketListener>
voidfillCrashReport(CrashReport report, T listener, @Nullable Packet<T> packet) static <T extends PacketListener>
ReportedExceptionmakeReportedException(Exception cause, Packet<T> packet, T listener)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
PacketUtils
public PacketUtils()
-
-
Method Details
-
ensureRunningOnSameThread
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T listener, ServerLevel level) throws RunningOnDifferentThreadException Ensures that the given packet is handled on the main thread. If the current thread is not the main thread, this method throwsRunningOnDifferentThreadException, which is caught and ignored in the outer call (Connection.channelRead0(io.netty.channel.ChannelHandlerContext, net.minecraft.network.protocol.Packet)). Additionally, it then re-schedules the packet to be handled on the main thread, which will then end up back here, but this time on the main thread. -
ensureRunningOnSameThread
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T listener, PacketProcessor packetProcessor) throws RunningOnDifferentThreadException -
makeReportedException
public static <T extends PacketListener> ReportedException makeReportedException(Exception cause, Packet<T> packet, T listener) -
fillCrashReport
public static <T extends PacketListener> void fillCrashReport(CrashReport report, T listener, @Nullable Packet<T> packet)
-