Package net.minecraft.network
Class ConnectionProtocol.PacketSet<T extends PacketListener>
java.lang.Object
net.minecraft.network.ConnectionProtocol.PacketSet<T>
- Enclosing class:
ConnectionProtocol
-
Field Summary
Modifier and TypeFieldDescriptionprivate BundlerInfo
(package private) final it.unimi.dsi.fastutil.objects.Object2IntMap<Class<? extends Packet<? super T>>>
private final List<BiFunction<FriendlyByteBuf,
io.netty.channel.ChannelHandlerContext, ? extends Packet<? super T>>> private final List<Function<FriendlyByteBuf,
? extends Packet<? super T>>> Deprecated.private static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<P extends Packet<? super T>>
ConnectionProtocol.PacketSet<T>addContextualPacket
(Class<P> p_178331_, BiFunction<FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, P> readerBuilder) <P extends Packet<? super T>>
ConnectionProtocol.PacketSet<T>addPacket
(Class<P> p_178331_, Function<FriendlyByteBuf, P> p_178332_) Packet<?>
createPacket
(int p_178328_, FriendlyByteBuf p_178329_) Deprecated.UsecreatePacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)
instead, which provides the channel context for creating custom packet payloads.Packet<?>
createPacket
(int p_178328_, FriendlyByteBuf p_178329_, io.netty.channel.ChannelHandlerContext p_130535_) Creates a new packet from the given discriminator and buffer.int
boolean
isKnownPacket
(Class<?> p_295070_) <P extends BundlePacket<T>>
ConnectionProtocol.PacketSet<T>
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
classToId
final it.unimi.dsi.fastutil.objects.Object2IntMap<Class<? extends Packet<? super T extends PacketListener>>> classToId -
idToDeserializer
@Deprecated private final List<Function<FriendlyByteBuf,? extends Packet<? super T extends PacketListener>>> idToDeserializerDeprecated.UsecontextualIdToDeserializer
instead it allows for context to be passed to the deserializer -
contextualIdToDeserializer
private final List<BiFunction<FriendlyByteBuf,io.netty.channel.ChannelHandlerContext, contextualIdToDeserializer? extends Packet<? super T extends PacketListener>>> -
bundlerInfo
-
extraClasses
-
-
Constructor Details
-
PacketSet
PacketSet()
-
-
Method Details
-
addPacket
public <P extends Packet<? super T>> ConnectionProtocol.PacketSet<T> addPacket(Class<P> p_178331_, Function<FriendlyByteBuf, P> p_178332_) -
addContextualPacket
public <P extends Packet<? super T>> ConnectionProtocol.PacketSet<T> addContextualPacket(Class<P> p_178331_, BiFunction<FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, P> readerBuilder) -
withBundlePacket
public <P extends BundlePacket<T>> ConnectionProtocol.PacketSet<T> withBundlePacket(Class<P> p_265034_, Function<Iterable<Packet<? super T>>, P> p_265591_) -
getId
-
isKnownPacket
-
createPacket
Deprecated.UsecreatePacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)
instead, which provides the channel context for creating custom packet payloads. -
createPacket
@Nullable public Packet<?> createPacket(int p_178328_, FriendlyByteBuf p_178329_, io.netty.channel.ChannelHandlerContext p_130535_) Creates a new packet from the given discriminator and buffer.- Parameters:
p_178328_
- The discriminatorp_178329_
- The bufferp_130535_
- The channel context- Returns:
- The packet, or null if no packet could be read.
-
bundlerInfo
-
contextualIdToDeserializer
instead it allows for context to be passed to the deserializer