public interface PacketContext
Modifier and Type | Method and Description |
---|---|
net.fabricmc.api.EnvType |
getPacketEnvironment()
Get the environment associated with the packet.
|
net.minecraft.entity.player.PlayerEntity |
getPlayer()
Get the player associated with the packet.
|
net.minecraft.util.thread.ThreadExecutor |
getTaskQueue()
Get the task queue for a given side.
|
net.fabricmc.api.EnvType getPacketEnvironment()
net.minecraft.entity.player.PlayerEntity getPlayer()
On the client side, this always returns the client-side player instance. On the server side, it returns the player belonging to the client this packet was sent by.
net.minecraft.util.thread.ThreadExecutor getTaskQueue()
As Minecraft networking I/O is asynchronous, but a lot of its logic is not thread-safe, it is recommended to do the following: