Package net.minecraft.network.protocol
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 processor, ServerLevel level) Ensures that the given packet is handled on the main thread.static <T extends PacketListener>
voidensureRunningOnSameThread(Packet<T> packet, T processor, BlockableEventLoop<?> executor) Ensures that the given packet is handled on the main thread.static <T extends PacketListener>
voidfillCrashReport(CrashReport crashReport, T packetListener, Packet<T> packet) static <T extends PacketListener>
ReportedExceptionmakeReportedException(Exception exception, Packet<T> packet, T packetListener)
-
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 processor, 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 processor, BlockableEventLoop<?> executor) 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. -
makeReportedException
public static <T extends PacketListener> ReportedException makeReportedException(Exception exception, Packet<T> packet, T packetListener) -
fillCrashReport
public static <T extends PacketListener> void fillCrashReport(CrashReport crashReport, T packetListener, @Nullable Packet<T> packet)
-