Package net.minecraftforge.network
Record Class PacketDistributor<T>
java.lang.Object
java.lang.Record
net.minecraftforge.network.PacketDistributor<T>
- Type Parameters:
- T-
public record PacketDistributor<T>(BiFunction<PacketDistributor<T>,T,Consumer<Packet<?>>> functor, NetworkDirection<?> direction)
extends Record  
Means to distribute packets in various ways
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final recordA Distributor curried with a specific value instance, for actual dispatchstatic final record
- 
Field SummaryFieldsModifier 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(T)DimensionTypeprivate final NetworkDirection<?> The field for thedirectionrecord component.private final BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> The field for thefunctorrecord component.static final PacketDistributor<PacketDistributor.TargetPoint> Send to everyone near thePacketDistributor.TargetPointspecified in the Supplier
 with(T)TargetPointstatic final PacketDistributor<List<Connection>> Send to the supplied list of NetworkManager instances in the Supplier
 with(T)List of NetworkManagerstatic final PacketDistributor<ServerPlayer> Send to the player specified in the Supplier
 with(T)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(T)Chunkstatic final PacketDistributor<Entity> Send to all tracking the Entity in the Supplier
 with(T)Entitystatic final PacketDistributor<Entity> Send to all tracking the Entity and Player in the Supplier
 with(T)Entity
- 
Constructor SummaryConstructorsConstructorDescriptionPacketDistributor(BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor) PacketDistributor(BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor, NetworkDirection<?> direction) Creates an instance of aPacketDistributorrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionclientToServer(Void ignored) Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor()Returns the value of thefunctorrecord component.private MinecraftServerfinal inthashCode()Returns a hash code value for this object.networkManagerList(List<Connection> connections) noArg()Apply a no argument value to a distributor to generate an instance for sending packets to.playerConsumer(ServerPlayer player) playerListAll(Void ignored) playerListDimConsumer(ResourceKey<Level> dimension) final StringtoString()Returns a string representation of this record class.trackingChunk(LevelChunk chunk) trackingEntity(Entity entity) trackingEntityAndSelf(Entity entity) Apply the supplied value to the specific distributor to generate an instance for sending packets to.
- 
Field Details- 
functorThe field for thefunctorrecord component.
- 
directionThe field for thedirectionrecord component.
- 
PLAYERSend to the player specified in the Supplier
 with(T)Player
- 
DIMENSIONSend to everyone in the dimension specified in the Supplier
 with(T)DimensionType
- 
NEARSend to everyone near thePacketDistributor.TargetPointspecified in the Supplier
 with(T)TargetPoint
- 
ALLSend to everyone
 noArg()
- 
SERVERSend to the server (CLIENT to SERVER)
 noArg()
- 
TRACKING_ENTITYSend to all tracking the Entity in the Supplier
 with(T)Entity
- 
TRACKING_ENTITY_AND_SELFSend to all tracking the Entity and Player in the Supplier
 with(T)Entity
- 
TRACKING_CHUNKSend to all tracking the Chunk in the Supplier
 with(T)Chunk
- 
NMLISTSend to the supplied list of NetworkManager instances in the Supplier
 with(T)List of NetworkManager
 
- 
- 
Constructor Details- 
PacketDistributor
- 
PacketDistributorpublic PacketDistributor(BiFunction<PacketDistributor<T>, T, Consumer<Packet<?>>> functor, NetworkDirection<?> direction) Creates an instance of aPacketDistributorrecord class.- Parameters:
- functor- the value for the- functorrecord component
- direction- the value for the- directionrecord component
 
 
- 
- 
Method Details- 
withApply 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
 
- 
noArgApply a no argument value to a distributor to generate an instance for sending packets to.- Returns:
- A curried instance
- See Also:
 
- 
playerConsumer
- 
playerListDimConsumer
- 
playerListAll
- 
clientToServer
- 
playerListPointConsumer
- 
trackingEntity
- 
trackingEntityAndSelf
- 
trackingChunk
- 
networkManagerList
- 
getServer
- 
toStringReturns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
- 
hashCodepublic final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
- 
equalsIndicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
- 
functorReturns the value of thefunctorrecord component.- Returns:
- the value of the functorrecord component
 
- 
directionReturns the value of thedirectionrecord component.- Returns:
- the value of the directionrecord component
 
 
-