Package commonnetwork.networking.data
Record Class PacketContainer<T>
java.lang.Object
java.lang.Record
commonnetwork.networking.data.PacketContainer<T>
public record PacketContainer<T>(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> classType, BiConsumer<T,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,T> decoder, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> codec, Consumer<PacketContext<T>> handler, PacketContainer.PacketType packetType)
extends Record
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> classType, BiConsumer<T, net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf, T> decoder, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler, PacketContainer.PacketType packetType) Creates an instance of aPacketContainerrecord class.PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> classType, net.minecraft.network.codec.StreamCodec<? super B, T> codec, Consumer<PacketContext<T>> handle, PacketContainer.PacketType packetType) PacketContainer(net.minecraft.resources.Identifier id, Class<T> classType, BiConsumer<T, net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf, T> decoder, Consumer<PacketContext<T>> handle) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassTyperecord component.net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec()Returns the value of thecodecrecord component.decoder()Returns the value of thedecoderrecord component.BiConsumer<T, net.minecraft.network.FriendlyByteBuf> encoder()Returns the value of theencoderrecord component.final booleanIndicates whether some other object is "equal to" this one.<K extends net.minecraft.network.FriendlyByteBuf>
net.minecraft.network.codec.StreamCodec<K, CommonPacketWrapper> getCodec()<K extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<K> getType()handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thepacketTyperecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type()Returns the value of thetyperecord component.
-
Constructor Details
-
PacketContainer
@Deprecated(forRemoval=true) public PacketContainer(net.minecraft.resources.Identifier id, Class<T> classType, BiConsumer<T, net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf, T> decoder, Consumer<PacketContext<T>> handle) Deprecated, for removal: This API element is subject to removal in a future version. -
PacketContainer
public PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> classType, net.minecraft.network.codec.StreamCodec<? super B, T> codec, Consumer<PacketContext<T>> handle, PacketContainer.PacketType packetType) -
PacketContainer
public PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> classType, BiConsumer<T, net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf, T> decoder, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler, PacketContainer.PacketType packetType) Creates an instance of aPacketContainerrecord class.- Parameters:
type- the value for thetyperecord componentclassType- the value for theclassTyperecord componentencoder- the value for theencoderrecord componentdecoder- the value for thedecoderrecord componentcodec- the value for thecodecrecord componenthandler- the value for thehandlerrecord componentpacketType- the value for thepacketTyperecord component
-
-
Method Details
-
getType
public <K extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<K> getType() -
getCodec
public <K extends net.minecraft.network.FriendlyByteBuf> net.minecraft.network.codec.StreamCodec<K,CommonPacketWrapper> getCodec() -
toString
Returns 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. -
hashCode
public 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. -
equals
Indicates 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). -
type
public net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type()Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
classType
Returns the value of theclassTyperecord component.- Returns:
- the value of the
classTyperecord component
-
encoder
Returns the value of theencoderrecord component.- Returns:
- the value of the
encoderrecord component
-
decoder
Returns the value of thedecoderrecord component.- Returns:
- the value of the
decoderrecord component
-
codec
public net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf,T> codec()Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
handler
Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-
packetType
Returns the value of thepacketTyperecord component.- Returns:
- the value of the
packetTyperecord component
-