public interface ServerSidePacketRegistry extends PacketRegistry
It is used for:
For iterating over clients in a server, see PlayerStream
.
Modifier and Type | Field and Description |
---|---|
static ServerSidePacketRegistry |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
boolean |
canPlayerReceive(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.Identifier id)
Check if a given client declared the ability to receive a given packet ID
using the vanilla "register/unregister" protocol.
|
default void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.Identifier id,
net.minecraft.network.PacketByteBuf buf)
Send an identifier/buffer-based packet to a given client.
|
default void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.Identifier id,
net.minecraft.network.PacketByteBuf buf,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> completionListener)
Send an identifier/buffer-based packet to a given client.
|
default void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.network.Packet<?> packet)
Send a packet to a given client.
|
void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.network.Packet<?> packet,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> completionListener)
Send a packet to a given client.
|
register, toPacket, unregister
static final ServerSidePacketRegistry INSTANCE
boolean canPlayerReceive(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Identifier id)
id
- The packet identifier.void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, net.minecraft.network.Packet<?> packet, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> completionListener)
player
- The given client.packet
- The packet to be sent.completionListener
- Completion listener. Can be used to check for
the success or failure of sending a given packet, among others.default void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Identifier id, net.minecraft.network.PacketByteBuf buf, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> completionListener)
player
- The given client.id
- The packet identifier.buf
- The packet byte buffer.completionListener
- Completion listener. Can be used to check for
the success or failure of sending a given packet, among others.default void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, net.minecraft.network.Packet<?> packet)
player
- The given client.packet
- The packet to be sent.default void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Identifier id, net.minecraft.network.PacketByteBuf buf)
player
- The given client.id
- The packet identifier.buf
- The packet byte buffer.