Record Class PacketContainer<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
java.lang.Object
java.lang.Record
commonnetwork.networking.data.PacketContainer<T>
public record PacketContainer<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> codec, Consumer<PacketContext<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>> handler, PacketContainer.PacketType packetType)
extends Record
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, 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. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.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<T> type()Returns the value of thetyperecord component.
-
Constructor Details
-
PacketContainer
public PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, 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 componentcodec- the value for thecodecrecord componenthandler- the value for thehandlerrecord componentpacketType- the value for thepacketTyperecord component
-
-
Method Details
-
toString
-
hashCode
-
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
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord 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
-