Package net.minecraftforge.network
Class PacketDistributor<T>
java.lang.Object
net.minecraftforge.network.PacketDistributor<T>
- Type Parameters:
T-
Means to distribute packets in various ways
- See Also:
-
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 in the Supplier
with(Supplier)DimensionTypeprivate final NetworkDirectionprivate final BiFunction<PacketDistributor<T>,Supplier<T>, Consumer<Packet<?>>> static final PacketDistributor<PacketDistributor.TargetPoint>Send to everyone near thePacketDistributor.TargetPointspecified in the Supplier
with(Supplier)TargetPointstatic final PacketDistributor<List<Connection>>Send to the supplied list of NetworkManager instances in the Supplier
with(Supplier)List of NetworkManagerstatic final PacketDistributor<ServerPlayer>Send to the player specified in the Supplier
with(Supplier)Playerstatic final PacketDistributor<Void>Send to the server (CLIENT to SERVER)
noArg()static final PacketDistributor<LevelChunk>Send to all tracking the Chunk in the Supplier
with(Supplier)Chunkstatic final PacketDistributor<Entity>Send to all tracking the Entity in the Supplier
with(Supplier)Entitystatic final PacketDistributor<Entity>Send to all tracking the Entity and Player in the Supplier
with(Supplier)Entity -
Constructor Summary
ConstructorsConstructorDescriptionPacketDistributor(BiFunction<PacketDistributor<T>, Supplier<T>, Consumer<Packet<?>>> functor, NetworkDirection direction) -
Method Summary
Modifier and TypeMethodDescriptionclientToServer(Supplier<Void> voidSupplier) private MinecraftServernetworkManagerList(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.TargetPointspecified 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
-