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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<AdventureData>
     
    static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,AdventureData>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AdventureData(net.minecraft.world.entity.EntityType<?> entityType, float damage, int xp)
    Creates an instance of a AdventureData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the damage record component.
    net.minecraft.world.entity.EntityType<?>
    Returns the value of the entityType record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static @Nullable AdventureData
    readFromItemStack(net.minecraft.world.item.ItemStack itemStack)
     
    final String
    Returns a string representation of this record class.
    static void
    updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<AdventureData> updater)
     
    void
    writeToItemStack(net.minecraft.world.item.ItemStack itemStack)
     
    int
    xp()
    Returns the value of the xp record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<AdventureData> 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 a AdventureData record class.
      Parameters:
      entityType - the value for the entityType record component
      damage - the value for the damage record component
      xp - the value for the xp record 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entityType

      public net.minecraft.world.entity.EntityType<?> entityType()
      Returns the value of the entityType record component.
      Returns:
      the value of the entityType record component
    • damage

      public float damage()
      Returns the value of the damage record component.
      Returns:
      the value of the damage record component
    • xp

      public int xp()
      Returns the value of the xp record component.
      Returns:
      the value of the xp record component