Record Class UpdatePayload
java.lang.Object
java.lang.Record
com.mrbysco.retraining.messages.UpdatePayload
- All Implemented Interfaces:
net.minecraft.network.protocol.common.custom.CustomPacketPayload
public record UpdatePayload(boolean villager, int experience)
extends Record
implements net.minecraft.network.protocol.common.custom.CustomPacketPayload
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
net.minecraft.network.protocol.common.custom.CustomPacketPayload.FallbackProvider<B>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B,T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf, UpdatePayload> static final net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<UpdatePayload> -
Constructor Summary
ConstructorsConstructorDescriptionUpdatePayload(boolean villager, int experience) Creates an instance of aUpdatePayloadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theexperiencerecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.@NotNull net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type()booleanvillager()Returns the value of thevillagerrecord component.
-
Field Details
-
CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf, UpdatePayload> CODEC -
ID
public static final net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<UpdatePayload> ID
-
-
Constructor Details
-
UpdatePayload
public UpdatePayload(boolean villager, int experience) Creates an instance of aUpdatePayloadrecord class.- Parameters:
villager- the value for thevillagerrecord componentexperience- the value for theexperiencerecord component
-
-
Method Details
-
type
@NotNull public @NotNull net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type()- Specified by:
typein interfacenet.minecraft.network.protocol.common.custom.CustomPacketPayload
-
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 with thecomparemethod from their corresponding wrapper classes. -
villager
public boolean villager()Returns the value of thevillagerrecord component.- Returns:
- the value of the
villagerrecord component
-
experience
public int experience()Returns the value of theexperiencerecord component.- Returns:
- the value of the
experiencerecord component
-