Package net.minecraftforge.fml.network
Class PacketDistributor<T>
- java.lang.Object
-
- net.minecraftforge.fml.network.PacketDistributor<T>
-
- Type Parameters:
T-
public class PacketDistributor<T> extends java.lang.ObjectMeans to distribute packets in various ways- See Also:
SimpleChannel.send(PacketTarget, Object)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPacketDistributor.PacketTargetA Distributor curried with a specific value instance, for actual dispatchstatic classPacketDistributor.TargetPoint
-
Field Summary
Fields Modifier and Type Field Description static PacketDistributor<java.lang.Void>ALLSend to everyone
noArg()static PacketDistributor<RegistryKey<World>>DIMENSIONSend to everyone in the dimension specified in the Supplier
with(Supplier)DimensionTypeprivate NetworkDirectiondirectionprivate java.util.function.BiFunction<PacketDistributor<T>,java.util.function.Supplier<T>,java.util.function.Consumer<IPacket<?>>>functorstatic PacketDistributor<PacketDistributor.TargetPoint>NEARSend to everyone near thePacketDistributor.TargetPointspecified in the Supplier
with(Supplier)TargetPointstatic PacketDistributor<java.util.List<NetworkManager>>NMLISTSend to the supplied list of NetworkManager instances in the Supplier
with(Supplier)List of NetworkManagerstatic PacketDistributor<ServerPlayerEntity>PLAYERSend to the player specified in the Supplier
with(Supplier)Playerstatic PacketDistributor<java.lang.Void>SERVERSend to the server (CLIENT to SERVER)
noArg()static PacketDistributor<Chunk>TRACKING_CHUNKSend to all tracking the Chunk in the Supplier
with(Supplier)Chunkstatic PacketDistributor<Entity>TRACKING_ENTITYSend to all tracking the Entity in the Supplier
with(Supplier)Entitystatic PacketDistributor<Entity>TRACKING_ENTITY_AND_SELFSend to all tracking the Entity and Player in the Supplier
with(Supplier)Entity
-
Constructor Summary
Constructors Constructor Description PacketDistributor(java.util.function.BiFunction<PacketDistributor<T>,java.util.function.Supplier<T>,java.util.function.Consumer<IPacket<?>>> functor, NetworkDirection direction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.function.Consumer<IPacket<?>>clientToServer(java.util.function.Supplier<java.lang.Void> voidSupplier)private MinecraftServergetServer()private java.util.function.Consumer<IPacket<?>>networkManagerList(java.util.function.Supplier<java.util.List<NetworkManager>> nmListSupplier)PacketDistributor.PacketTargetnoArg()Apply a no argument value to a distributor to generate an instance for sending packets to.private java.util.function.Consumer<IPacket<?>>playerConsumer(java.util.function.Supplier<ServerPlayerEntity> entityPlayerMPSupplier)private java.util.function.Consumer<IPacket<?>>playerListAll(java.util.function.Supplier<java.lang.Void> voidSupplier)private java.util.function.Consumer<IPacket<?>>playerListDimConsumer(java.util.function.Supplier<RegistryKey<World>> dimensionTypeSupplier)private java.util.function.Consumer<IPacket<?>>playerListPointConsumer(java.util.function.Supplier<PacketDistributor.TargetPoint> targetPointSupplier)private java.util.function.Consumer<IPacket<?>>trackingChunk(java.util.function.Supplier<Chunk> chunkPosSupplier)private java.util.function.Consumer<IPacket<?>>trackingEntity(java.util.function.Supplier<Entity> entitySupplier)private java.util.function.Consumer<IPacket<?>>trackingEntityAndSelf(java.util.function.Supplier<Entity> entitySupplier)PacketDistributor.PacketTargetwith(java.util.function.Supplier<T> input)Apply the supplied value to the specific distributor to generate an instance for sending packets to.
-
-
-
Field Detail
-
PLAYER
public static final PacketDistributor<ServerPlayerEntity> PLAYER
Send to the player specified in the Supplier
with(Supplier)Player
-
DIMENSION
public static final PacketDistributor<RegistryKey<World>> DIMENSION
Send to everyone in the dimension specified in the Supplier
with(Supplier)DimensionType
-
NEAR
public static final PacketDistributor<PacketDistributor.TargetPoint> NEAR
Send to everyone near thePacketDistributor.TargetPointspecified in the Supplier
with(Supplier)TargetPoint
-
ALL
public static final PacketDistributor<java.lang.Void> ALL
Send to everyone
noArg()
-
SERVER
public static final PacketDistributor<java.lang.Void> SERVER
Send to the server (CLIENT to SERVER)
noArg()
-
TRACKING_ENTITY
public static final PacketDistributor<Entity> TRACKING_ENTITY
Send to all tracking the Entity in the Supplier
with(Supplier)Entity
-
TRACKING_ENTITY_AND_SELF
public static final PacketDistributor<Entity> TRACKING_ENTITY_AND_SELF
Send to all tracking the Entity and Player in the Supplier
with(Supplier)Entity
-
TRACKING_CHUNK
public static final PacketDistributor<Chunk> TRACKING_CHUNK
Send to all tracking the Chunk in the Supplier
with(Supplier)Chunk
-
NMLIST
public static final PacketDistributor<java.util.List<NetworkManager>> NMLIST
Send to the supplied list of NetworkManager instances in the Supplier
with(Supplier)List of NetworkManager
-
functor
private final java.util.function.BiFunction<PacketDistributor<T>,java.util.function.Supplier<T>,java.util.function.Consumer<IPacket<?>>> functor
-
direction
private final NetworkDirection direction
-
-
Constructor Detail
-
PacketDistributor
public PacketDistributor(java.util.function.BiFunction<PacketDistributor<T>,java.util.function.Supplier<T>,java.util.function.Consumer<IPacket<?>>> functor, NetworkDirection direction)
-
-
Method Detail
-
with
public PacketDistributor.PacketTarget with(java.util.function.Supplier<T> input)
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
public PacketDistributor.PacketTarget noArg()
Apply a no argument value to a distributor to generate an instance for sending packets to.
-
playerConsumer
private java.util.function.Consumer<IPacket<?>> playerConsumer(java.util.function.Supplier<ServerPlayerEntity> entityPlayerMPSupplier)
-
playerListDimConsumer
private java.util.function.Consumer<IPacket<?>> playerListDimConsumer(java.util.function.Supplier<RegistryKey<World>> dimensionTypeSupplier)
-
playerListAll
private java.util.function.Consumer<IPacket<?>> playerListAll(java.util.function.Supplier<java.lang.Void> voidSupplier)
-
clientToServer
private java.util.function.Consumer<IPacket<?>> clientToServer(java.util.function.Supplier<java.lang.Void> voidSupplier)
-
playerListPointConsumer
private java.util.function.Consumer<IPacket<?>> playerListPointConsumer(java.util.function.Supplier<PacketDistributor.TargetPoint> targetPointSupplier)
-
trackingEntity
private java.util.function.Consumer<IPacket<?>> trackingEntity(java.util.function.Supplier<Entity> entitySupplier)
-
trackingEntityAndSelf
private java.util.function.Consumer<IPacket<?>> trackingEntityAndSelf(java.util.function.Supplier<Entity> entitySupplier)
-
trackingChunk
private java.util.function.Consumer<IPacket<?>> trackingChunk(java.util.function.Supplier<Chunk> chunkPosSupplier)
-
networkManagerList
private java.util.function.Consumer<IPacket<?>> networkManagerList(java.util.function.Supplier<java.util.List<NetworkManager>> nmListSupplier)
-
getServer
private MinecraftServer getServer()
-
-