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> pPacket, T pListener, PacketProcessor pPacketProcessor) static <T extends PacketListener>
voidensureRunningOnSameThread(Packet<T> pPacket, T pProcessor, ServerLevel pLevel) Ensures that the given packet is handled on the main thread.static <T extends PacketListener>
voidfillCrashReport(CrashReport pCrashReport, T pPacketListener, Packet<T> pPacket) static <T extends PacketListener>
ReportedExceptionmakeReportedException(Exception pException, Packet<T> pPacket, T pPacketListener)
-
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> pPacket, T pProcessor, ServerLevel pLevel) 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> pPacket, T pListener, PacketProcessor pPacketProcessor) throws RunningOnDifferentThreadException -
makeReportedException
public static <T extends PacketListener> ReportedException makeReportedException(Exception pException, Packet<T> pPacket, T pPacketListener) -
fillCrashReport
public static <T extends PacketListener> void fillCrashReport(CrashReport pCrashReport, T pPacketListener, @Nullable Packet<T> pPacket)
-