Record Class AdvancementRewards

java.lang.Object
java.lang.Record
net.minecraft.advancements.AdvancementRewards

public record AdvancementRewards(int experience, List<ResourceLocation> loot, List<ResourceLocation> recipes, Optional<CacheableFunction> function) extends Record
  • Field Details

    • experience

      private final int experience
      The field for the experience record component.
    • loot

      private final List<ResourceLocation> loot
      The field for the loot record component.
    • recipes

      private final List<ResourceLocation> recipes
      The field for the recipes record component.
    • function

      private final Optional<CacheableFunction> function
      The field for the function record component.
    • CODEC

      public static final com.mojang.serialization.Codec<AdvancementRewards> CODEC
    • EMPTY

      public static final AdvancementRewards EMPTY
  • Constructor Details

    • AdvancementRewards

      public AdvancementRewards(int experience, List<ResourceLocation> loot, List<ResourceLocation> recipes, Optional<CacheableFunction> function)
      Creates an instance of a AdvancementRewards record class.
      Parameters:
      experience - the value for the experience record component
      loot - the value for the loot record component
      recipes - the value for the recipes record component
      function - the value for the function record component
  • Method Details

    • grant

      public void grant(ServerPlayer p_9990_)
    • 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.
    • experience

      public int experience()
      Returns the value of the experience record component.
      Returns:
      the value of the experience record component
    • loot

      public List<ResourceLocation> loot()
      Returns the value of the loot record component.
      Returns:
      the value of the loot record component
    • recipes

      public List<ResourceLocation> recipes()
      Returns the value of the recipes record component.
      Returns:
      the value of the recipes record component
    • function

      public Optional<CacheableFunction> function()
      Returns the value of the function record component.
      Returns:
      the value of the function record component