Record Class NetworkChannel.NetworkRegistrationData<T>
java.lang.Object
java.lang.Record
com.hammy275.immersivemc.common.network.NetworkChannel.NetworkRegistrationData<T>
- Enclosing class:
NetworkChannel
public static record NetworkChannel.NetworkRegistrationData<T>(int id, Class<T> clazz, BiConsumer<T,net.minecraft.network.RegistryFriendlyByteBuf> encoder, Function<net.minecraft.network.RegistryFriendlyByteBuf,T> decoder, BiConsumer<T,net.minecraft.server.level.ServerPlayer> handler)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkRegistrationData(int id, Class<T> clazz, BiConsumer<T, net.minecraft.network.RegistryFriendlyByteBuf> encoder, Function<net.minecraft.network.RegistryFriendlyByteBuf, T> decoder, BiConsumer<T, net.minecraft.server.level.ServerPlayer> handler) Creates an instance of aNetworkRegistrationDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionclazz()Returns the value of theclazzrecord component.decoder()Returns the value of thedecoderrecord component.BiConsumer<T, net.minecraft.network.RegistryFriendlyByteBuf> encoder()Returns the value of theencoderrecord component.final booleanIndicates whether some other object is "equal to" this one.BiConsumer<T, net.minecraft.server.level.ServerPlayer> handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NetworkRegistrationData
public NetworkRegistrationData(int id, Class<T> clazz, BiConsumer<T, net.minecraft.network.RegistryFriendlyByteBuf> encoder, Function<net.minecraft.network.RegistryFriendlyByteBuf, T> decoder, BiConsumer<T, net.minecraft.server.level.ServerPlayer> handler) Creates an instance of aNetworkRegistrationDatarecord class.- Parameters:
id- the value for theidrecord componentclazz- the value for theclazzrecord componentencoder- the value for theencoderrecord componentdecoder- the value for thedecoderrecord componenthandler- the value for thehandlerrecord component
-
-
Method Details
-
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 '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
clazz
Returns the value of theclazzrecord component.- Returns:
- the value of the
clazzrecord 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
-
handler
Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-