Package net.neoforged.neoforge.network
Class PacketDistributor
java.lang.Object
net.neoforged.neoforge.network.PacketDistributor
Means to distribute packets in various ways
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate static Packet<?> makeClientboundPacket(CustomPacketPayload payload, CustomPacketPayload... payloads) static voidsendToAllPlayers(CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players on the serverstatic voidsendToPlayer(ServerPlayer player, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the given playerstatic voidsendToPlayersInDimension(ServerLevel level, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the given dimensionstatic voidsendToPlayersNear(ServerLevel level, @Nullable ServerPlayer excluded, double x, double y, double z, double radius, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the area covered by the given radius around the given coordinates in the given dimension, except the given excluded player if presentstatic voidsendToPlayersTrackingChunk(ServerLevel level, ChunkPos chunkPos, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the chunk at the given position in the given levelstatic voidsendToPlayersTrackingEntity(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entitystatic voidsendToPlayersTrackingEntityAndSelf(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entity and the entity itself if it is a playerstatic voidsendToServer(CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the server
- 
Constructor Details- 
PacketDistributorprivate PacketDistributor()
 
- 
- 
Method Details- 
sendToServerSend the given payload(s) to the server
- 
sendToPlayerpublic static void sendToPlayer(ServerPlayer player, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the given player
- 
sendToPlayersInDimensionpublic static void sendToPlayersInDimension(ServerLevel level, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the given dimension
- 
sendToPlayersNearpublic static void sendToPlayersNear(ServerLevel level, @Nullable @Nullable ServerPlayer excluded, double x, double y, double z, double radius, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the area covered by the given radius around the given coordinates in the given dimension, except the given excluded player if present
- 
sendToAllPlayersSend the given payload(s) to all players on the server
- 
sendToPlayersTrackingEntitypublic static void sendToPlayersTrackingEntity(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entity
- 
sendToPlayersTrackingEntityAndSelfpublic static void sendToPlayersTrackingEntityAndSelf(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entity and the entity itself if it is a player
- 
sendToPlayersTrackingChunkpublic static void sendToPlayersTrackingChunk(ServerLevel level, ChunkPos chunkPos, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the chunk at the given position in the given level
- 
makeClientboundPacketprivate static Packet<?> makeClientboundPacket(CustomPacketPayload payload, CustomPacketPayload... payloads) 
 
-