Package dev.latvian.mods.klib.data
Record Class DataTypeBuilderStreamCodec<C>
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.data.DataTypeBuilderStreamCodec<C>
- All Implemented Interfaces:
KLibStreamCodec<io.netty.buffer.ByteBuf,,C> net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,,C> net.minecraft.network.codec.StreamDecoder<io.netty.buffer.ByteBuf,,C> net.minecraft.network.codec.StreamEncoder<io.netty.buffer.ByteBuf,C>
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.codec.StreamCodec
net.minecraft.network.codec.StreamCodec.CodecOperation<B,S, T> -
Constructor Summary
ConstructorsConstructorDescriptionDataTypeBuilderStreamCodec(List<DataTypeField<C, ?>> fields, Function<Object[], C> constructor) DataTypeBuilderStreamCodec(List<DataTypeField<C, ?>> fields, Function<Object[], C> constructor, boolean canBeOptional) Creates an instance of aDataTypeBuilderStreamCodecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanBeOptionalrecord component.Returns the value of theconstructorrecord component.decode(io.netty.buffer.ByteBuf buf) voidfinal booleanIndicates whether some other object is "equal to" this one.List<DataTypeField<C, ?>> fields()Returns the value of thefieldsrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.network.codec.StreamCodec
apply, cast, dispatch, map, mapStream
-
Constructor Details
-
DataTypeBuilderStreamCodec
-
DataTypeBuilderStreamCodec
public DataTypeBuilderStreamCodec(List<DataTypeField<C, ?>> fields, Function<Object[], C> constructor, boolean canBeOptional) Creates an instance of aDataTypeBuilderStreamCodecrecord class.- Parameters:
fields- the value for thefieldsrecord componentconstructor- the value for theconstructorrecord componentcanBeOptional- the value for thecanBeOptionalrecord component
-
-
Method Details
-
decode
- Specified by:
decodein interfacenet.minecraft.network.codec.StreamDecoder<io.netty.buffer.ByteBuf,C>
-
encode
- Specified by:
encodein interfacenet.minecraft.network.codec.StreamEncoder<io.netty.buffer.ByteBuf,C>
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-
constructor
Returns the value of theconstructorrecord component.- Returns:
- the value of the
constructorrecord component
-
canBeOptional
public boolean canBeOptional()Returns the value of thecanBeOptionalrecord component.- Returns:
- the value of the
canBeOptionalrecord component
-