Record Class AdventureData
java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.AdventureData
public record AdventureData(net.minecraft.world.entity.EntityType<?> entityType, float damage, int xp)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<AdventureData> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, AdventureData> -
Constructor Summary
ConstructorsConstructorDescriptionAdventureData(net.minecraft.world.entity.EntityType<?> entityType, float damage, int xp) Creates an instance of aAdventureDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatdamage()Returns the value of thedamagerecord component.net.minecraft.world.entity.EntityType<?> Returns the value of theentityTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static @Nullable AdventureDatareadFromItemStack(net.minecraft.world.item.ItemStack itemStack) final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<AdventureData> updater) voidwriteToItemStack(net.minecraft.world.item.ItemStack itemStack) intxp()Returns the value of thexprecord component.
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,AdventureData> STREAM_CODEC
-
-
Constructor Details
-
AdventureData
public AdventureData(net.minecraft.world.entity.EntityType<?> entityType, float damage, int xp) Creates an instance of aAdventureDatarecord class.- Parameters:
entityType- the value for theentityTyperecord componentdamage- the value for thedamagerecord componentxp- the value for thexprecord component
-
-
Method Details
-
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) -
readFromItemStack
@Nullable public static @Nullable AdventureData readFromItemStack(net.minecraft.world.item.ItemStack itemStack) -
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<AdventureData> updater) -
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 '=='. -
entityType
public net.minecraft.world.entity.EntityType<?> entityType()Returns the value of theentityTyperecord component.- Returns:
- the value of the
entityTyperecord component
-
damage
public float damage()Returns the value of thedamagerecord component.- Returns:
- the value of the
damagerecord component
-
xp
public int xp()Returns the value of thexprecord component.- Returns:
- the value of the
xprecord component
-