Package net.neoforged.neoforge.network
Class PacketDistributor<T>
java.lang.Object
net.neoforged.neoforge.network.PacketDistributor<T>
Means to distribute packets in various ways
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Distributor curried with a specific value instance, for actual dispatchstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PacketDistributor<Void>Send to everyone
noArg()static final PacketDistributor<ResourceKey<Level>>Send to everyone in the dimension specified
with(Object)DimensionTypeprivate final PacketFlowprivate final BiFunction<PacketDistributor<T>,T, Consumer<Packet<?>>> static final PacketDistributor<PacketDistributor.TargetPoint>static final PacketDistributor<ServerPlayer>Send to the player specified
with(Object)Playerstatic final PacketDistributor<Void>Send to the server (CLIENT to SERVER)
noArg()static final PacketDistributor<LevelChunk>Send to all tracking the Chunk
with(Object)Chunkstatic final PacketDistributor<Entity>Send to all tracking the Entity
with(Object)Entitystatic final PacketDistributor<Entity>Send to all tracking the Entity and Player
with(Object)Entity -
Constructor Summary
ConstructorsConstructorDescriptionPacketDistributor(BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor, PacketFlow flow) PacketDistributor(Function<PacketDistributor<T>, Consumer<Packet<?>>> functor, PacketFlow flow) -
Method Summary
Modifier and TypeMethodDescriptionprivate MinecraftServernoArg()Apply a no argument value to a distributor to generate an instance for sending packets to.playerConsumer(ServerPlayer entityPlayerMP) playerListDimConsumer(ResourceKey<Level> dimensionType) playerListPointConsumer(PacketDistributor.TargetPoint targetPoint) trackingChunk(LevelChunk chunkPos) trackingEntity(Entity entity) trackingEntityAndSelf(Entity entity) Apply the supplied value to the specific distributor to generate an instance for sending packets to.
-
Field Details
-
PLAYER
Send to the player specified
with(Object)Player -
DIMENSION
Send to everyone in the dimension specified
with(Object)DimensionType -
NEAR
-
ALL
Send to everyone
noArg() -
SERVER
Send to the server (CLIENT to SERVER)
noArg() -
TRACKING_ENTITY
Send to all tracking the Entity
with(Object)Entity -
TRACKING_ENTITY_AND_SELF
Send to all tracking the Entity and Player
with(Object)Entity -
TRACKING_CHUNK
Send to all tracking the Chunk
with(Object)Chunk -
functor
-
flow
-
-
Constructor Details
-
PacketDistributor
public PacketDistributor(BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor, PacketFlow flow) -
PacketDistributor
public PacketDistributor(Function<PacketDistributor<T>, Consumer<Packet<?>>> functor, PacketFlow flow)
-
-
Method Details
-
with
Apply the supplied value to the specific distributor to generate an instance for sending packets to.- Parameters:
input- The input to apply- Returns:
- A curried instance
-
noArg
Apply a no argument value to a distributor to generate an instance for sending packets to. -
playerConsumer
-
playerListDimConsumer
-
playerListAll
-
clientToServer
-
playerListPointConsumer
-
trackingEntity
-
trackingEntityAndSelf
-
trackingChunk
-
getServer
-