Record Class Ability

java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.ability.Ability
Record Components:
affinity - The Affinity to associate the ability with.
bounds - The MinMaxBounds.Doubles within which the ability becomes active. Should overlap with the range [0, 1].
negative - Whether the ability should be considered negative or not.
effects - A list of AbilityEffects that this ability applies.
All Implemented Interfaces:
Predicate<net.minecraft.world.entity.player.Player>

public record Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, boolean negative, List<AbilityEffect> effects) extends Record implements Predicate<net.minecraft.world.entity.player.Player>
Represents an affinity ability.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Ability>>
     
    static final com.mojang.serialization.Codec<Ability>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, boolean negative, AbilityEffect effect)
     
    Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, boolean negative, List<AbilityEffect> effects)
    Creates an instance of a Ability record class.
    Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, AbilityEffect effect)
     
    Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, List<AbilityEffect> effects)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.core.Holder<Affinity>
    Returns the value of the affinity record component.
    net.minecraft.advancements.criterion.MinMaxBounds.Doubles
    Returns the value of the bounds record component.
    Returns the value of the effects record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static net.minecraft.network.chat.MutableComponent
    getName(net.minecraft.core.Holder<Ability> holder)
     
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the negative record component.
    boolean
     
    boolean
    test(net.minecraft.world.entity.player.Player player)
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Predicate

    and, negate, or
  • Field Details

    • DIRECT_CODEC

      public static final com.mojang.serialization.Codec<Ability> DIRECT_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Ability>> CODEC
  • Constructor Details

    • Ability

      public Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, List<AbilityEffect> effects)
      Parameters:
      affinity - The Affinity to associate the ability with.
      bounds - The MinMaxBounds.Doubles within which the ability becomes active. Should overlap with the range [0, 1].
      effects - A list of AbilityEffects that this ability applies.
    • Ability

      public Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, boolean negative, AbilityEffect effect)
      Parameters:
      affinity - The Affinity to associate the ability with.
      bounds - The MinMaxBounds.Doubles within which the ability becomes active. Should overlap with the range [0, 1].
      negative - Whether the ability should be considered negative or not.
      effect - The AbilityEffect that this ability applies.
    • Ability

      public Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, AbilityEffect effect)
      Parameters:
      affinity - The Affinity to associate the ability with.
      bounds - The MinMaxBounds.Doubles within which the ability becomes active. Should overlap with the range [0, 1].
      effect - The AbilityEffect that this ability applies.
    • Ability

      public Ability(net.minecraft.core.Holder<Affinity> affinity, net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds, boolean negative, List<AbilityEffect> effects)
      Creates an instance of a Ability record class.
      Parameters:
      affinity - the value for the affinity record component
      bounds - the value for the bounds record component
      negative - the value for the negative record component
      effects - the value for the effects record component
  • Method Details

    • test

      public boolean test(net.minecraft.world.entity.player.Player player)
      Specified by:
      test in interface Predicate<net.minecraft.world.entity.player.Player>
      Parameters:
      player - The Player to query.
      Returns:
      Whether the given Player matches the bounds.
    • test

      public boolean test(MagicAttachment data)
      Parameters:
      data - The MagicAttachment to query.
      Returns:
      Whether the given MagicAttachment matches the bounds.
    • getName

      public static net.minecraft.network.chat.MutableComponent getName(net.minecraft.core.Holder<Ability> holder)
      Parameters:
      holder - The ability Holder to query.
      Returns:
      The display name of the given ability.
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • affinity

      public net.minecraft.core.Holder<Affinity> affinity()
      Returns the value of the affinity record component.
      Returns:
      the value of the affinity record component
    • bounds

      public net.minecraft.advancements.criterion.MinMaxBounds.Doubles bounds()
      Returns the value of the bounds record component.
      Returns:
      the value of the bounds record component
    • negative

      public boolean negative()
      Returns the value of the negative record component.
      Returns:
      the value of the negative record component
    • effects

      public List<AbilityEffect> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component