Class PacketDistributor

java.lang.Object
net.neoforged.neoforge.network.PacketDistributor

public final class PacketDistributor extends Object
Means to distribute packets in various ways
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static net.minecraft.network.protocol.Packet<?>
    makeClientboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
     
    static void
    sendToAllPlayers(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to all players on the server
    static void
    sendToPlayer(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to the given player
    static void
    sendToPlayersInDimension(net.minecraft.server.level.ServerLevel level, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to all players in the given dimension
    static void
    sendToPlayersNear(net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.server.level.ServerPlayer excluded, double x, double y, double z, double radius, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.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
    static void
    sendToPlayersTrackingChunk(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos chunkPos, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to all players tracking the chunk at the given position in the given level
    static void
    sendToPlayersTrackingEntity(net.minecraft.world.entity.Entity entity, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to all players tracking the given entity
    static void
    sendToPlayersTrackingEntityAndSelf(net.minecraft.world.entity.Entity entity, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to all players tracking the given entity and the entity itself if it is a player
    static void
    sendToServer(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
    Send the given payload(s) to the server

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PacketDistributor

      private PacketDistributor()
  • Method Details

    • sendToServer

      public static void sendToServer(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to the server
    • sendToPlayer

      public static void sendToPlayer(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to the given player
    • sendToPlayersInDimension

      public static void sendToPlayersInDimension(net.minecraft.server.level.ServerLevel level, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to all players in the given dimension
    • sendToPlayersNear

      public static void sendToPlayersNear(net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.server.level.ServerPlayer excluded, double x, double y, double z, double radius, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.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

      public static void sendToAllPlayers(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to all players on the server
    • sendToPlayersTrackingEntity

      public static void sendToPlayersTrackingEntity(net.minecraft.world.entity.Entity entity, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to all players tracking the given entity
    • sendToPlayersTrackingEntityAndSelf

      public static void sendToPlayersTrackingEntityAndSelf(net.minecraft.world.entity.Entity entity, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.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(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos chunkPos, net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)
      Send the given payload(s) to all players tracking the chunk at the given position in the given level
    • makeClientboundPacket

      private static net.minecraft.network.protocol.Packet<?> makeClientboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload, net.minecraft.network.protocol.common.custom.CustomPacketPayload... payloads)