Class PacketDistributor<T>
java.lang.Object
net.minecraftforge.fmllegacy.network.PacketDistributor<T>
- Type Parameters:
T
-
Means to distribute packets in various ways
- See Also:
SimpleChannel.send(PacketTarget, Object)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A Distributor curried with a specific value instance, for actual dispatchstatic class
-
Field Summary
Modifier and TypeFieldDescriptionstatic PacketDistributor<Void>
Send to everyone
noArg()
static PacketDistributor<ResourceKey<Level>>
Send to everyone in the dimension specified in the Supplier
with(Supplier)
DimensionTypeprivate NetworkDirection
private BiFunction<PacketDistributor<T>,Supplier<T>,Consumer<Packet<?>>>
Send to everyone near thePacketDistributor.TargetPoint
specified in the Supplier
with(Supplier)
TargetPointstatic PacketDistributor<List<Connection>>
Send to the supplied list of NetworkManager instances in the Supplier
with(Supplier)
List of NetworkManagerstatic PacketDistributor<ServerPlayer>
Send to the player specified in the Supplier
with(Supplier)
Playerstatic PacketDistributor<Void>
Send to the server (CLIENT to SERVER)
noArg()
static PacketDistributor<LevelChunk>
Send to all tracking the Chunk in the Supplier
with(Supplier)
Chunkstatic PacketDistributor<Entity>
Send to all tracking the Entity in the Supplier
with(Supplier)
Entitystatic PacketDistributor<Entity>
Send to all tracking the Entity and Player in the Supplier
with(Supplier)
Entity -
Constructor Summary
ConstructorDescriptionPacketDistributor(BiFunction<PacketDistributor<T>,Supplier<T>,Consumer<Packet<?>>> functor, NetworkDirection direction)
-
Method Summary
Modifier and TypeMethodDescriptionclientToServer(Supplier<Void> voidSupplier)
private MinecraftServer
networkManagerList(Supplier<List<Connection>> nmListSupplier)
noArg()
Apply a no argument value to a distributor to generate an instance for sending packets to.playerConsumer(Supplier<ServerPlayer> entityPlayerMPSupplier)
playerListAll(Supplier<Void> voidSupplier)
playerListDimConsumer(Supplier<ResourceKey<Level>> dimensionTypeSupplier)
playerListPointConsumer(Supplier<PacketDistributor.TargetPoint> targetPointSupplier)
trackingChunk(Supplier<LevelChunk> chunkPosSupplier)
trackingEntity(Supplier<Entity> entitySupplier)
trackingEntityAndSelf(Supplier<Entity> entitySupplier)
Apply the supplied value to the specific distributor to generate an instance for sending packets to.
-
Field Details
-
PLAYER
Send to the player specified in the Supplier
with(Supplier)
Player -
DIMENSION
Send to everyone in the dimension specified in the Supplier
with(Supplier)
DimensionType -
NEAR
Send to everyone near thePacketDistributor.TargetPoint
specified in the Supplier
with(Supplier)
TargetPoint -
ALL
Send to everyone
noArg()
-
SERVER
Send to the server (CLIENT to SERVER)
noArg()
-
TRACKING_ENTITY
Send to all tracking the Entity in the Supplier
with(Supplier)
Entity -
TRACKING_ENTITY_AND_SELF
Send to all tracking the Entity and Player in the Supplier
with(Supplier)
Entity -
TRACKING_CHUNK
Send to all tracking the Chunk in the Supplier
with(Supplier)
Chunk -
NMLIST
Send to the supplied list of NetworkManager instances in the Supplier
with(Supplier)
List of NetworkManager -
functor
-
direction
-
-
Constructor Details
-
PacketDistributor
public PacketDistributor(BiFunction<PacketDistributor<T>,Supplier<T>,Consumer<Packet<?>>> functor, NetworkDirection direction)
-
-
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
private Consumer<Packet<?>> playerListDimConsumer(Supplier<ResourceKey<Level>> dimensionTypeSupplier) -
playerListAll
-
clientToServer
-
playerListPointConsumer
private Consumer<Packet<?>> playerListPointConsumer(Supplier<PacketDistributor.TargetPoint> targetPointSupplier) -
trackingEntity
-
trackingEntityAndSelf
-
trackingChunk
-
networkManagerList
-
getServer
-