Package net.neoforged.neoforge.network
Class PacketDistributor
java.lang.Object
net.neoforged.neoforge.network.PacketDistributor
Means to distribute packets in various ways
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static Packet
<?> makeClientboundPacket
(CustomPacketPayload payload, CustomPacketPayload... payloads) static void
sendToAllPlayers
(CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players on the serverstatic void
sendToPlayer
(ServerPlayer player, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the given playerstatic void
sendToPlayersInDimension
(ServerLevel level, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the given dimensionstatic void
sendToPlayersNear
(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 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 levelstatic void
sendToPlayersTrackingEntity
(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entitystatic 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 playerstatic void
sendToServer
(CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the server
-
Constructor Details
-
PacketDistributor
private PacketDistributor()
-
-
Method Details
-
sendToServer
Send the given payload(s) to the server -
sendToPlayer
public static void sendToPlayer(ServerPlayer player, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to the given player -
sendToPlayersInDimension
public static void sendToPlayersInDimension(ServerLevel level, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players in the given dimension -
sendToPlayersNear
public 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 -
sendToAllPlayers
Send the given payload(s) to all players on the server -
sendToPlayersTrackingEntity
public static void sendToPlayersTrackingEntity(Entity entity, CustomPacketPayload payload, CustomPacketPayload... payloads) Send the given payload(s) to all players tracking the given entity -
sendToPlayersTrackingEntityAndSelf
public 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 -
sendToPlayersTrackingChunk
public 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 -
makeClientboundPacket
private static Packet<?> makeClientboundPacket(CustomPacketPayload payload, CustomPacketPayload... payloads)
-