Record Class Affinity

java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.magic.Affinity
Record Components:
directOpposite - The direct opposite affinity. When shifting into an affinity, one will also shift away by a large amount from the direct opposite.
majorOpposites - The major opposite affinities. When shifting into an affinity, one will also shift away by a moderate amount from the major opposites.
minorOpposites - The minor opposite affinities. When shifting into an affinity, one will also shift away by a small amount from the minor opposites.
adjacents - The adjacent affinities. When shifting into an affinity, one will also shift towards the adjacents by a small amount.
color - The color of the affinity.
index - The index of the affinity when displaying in the occulus. The built-in affinities use int values 1-10, use floating point values to insert your affinities between them. Use values < 0 to not display the affinity in the occulus.
castSound - The SoundEvent to use for casting Spells with the affinity.
loopSound - The SoundEvent to use for casting continuous Spells with the affinity.
particle - The ParticleOptions to associate with the affinity.

public record Affinity(net.minecraft.core.Holder<Affinity> directOpposite, List<net.minecraft.core.Holder<Affinity>> majorOpposites, List<net.minecraft.core.Holder<Affinity>> minorOpposites, List<net.minecraft.core.Holder<Affinity>> adjacents, int color, double index, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> castSound, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> loopSound, net.minecraft.core.particles.ParticleOptions particle) extends Record
Represents an affinity.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Affinity(net.minecraft.core.Holder<Affinity> directOpposite, List<net.minecraft.core.Holder<Affinity>> majorOpposites, List<net.minecraft.core.Holder<Affinity>> minorOpposites, List<net.minecraft.core.Holder<Affinity>> adjacents, int color, double index, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> castSound, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> loopSound, net.minecraft.core.particles.ParticleOptions particle)
    Creates an instance of a Affinity record class.
    Affinity(net.minecraft.core.Holder<Affinity> directOpposite, List<net.minecraft.core.Holder<Affinity>> majorOpposites, List<net.minecraft.core.Holder<Affinity>> minorOpposites, List<net.minecraft.core.Holder<Affinity>> adjacents, int color, double index, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> castSound, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> loopSound, net.minecraft.core.particles.ParticleOptions particle)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<net.minecraft.core.Holder<Affinity>>
    Returns the value of the adjacents record component.
    Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>>
    Returns the value of the castSound record component.
    int
    Returns the value of the color record component.
    net.minecraft.core.Holder<Affinity>
    Returns the value of the directOpposite 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<Affinity> holder)
     
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the index record component.
    Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>>
    Returns the value of the loopSound record component.
    List<net.minecraft.core.Holder<Affinity>>
    Returns the value of the majorOpposites record component.
    List<net.minecraft.core.Holder<Affinity>>
    Returns the value of the minorOpposites record component.
    net.minecraft.core.particles.ParticleOptions
    Returns the value of the particle record component.
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • DIRECT_CODEC

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

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Affinity>> CODEC
    • NONE

      public static final net.minecraft.resources.ResourceKey<Affinity> NONE
  • Constructor Details

    • Affinity

      public Affinity(net.minecraft.core.Holder<Affinity> directOpposite, List<net.minecraft.core.Holder<Affinity>> majorOpposites, List<net.minecraft.core.Holder<Affinity>> minorOpposites, List<net.minecraft.core.Holder<Affinity>> adjacents, int color, double index, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> castSound, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> loopSound, net.minecraft.core.particles.ParticleOptions particle)
      Parameters:
      directOpposite - The direct opposite affinity.
      majorOpposites - The major opposite affinities.
      minorOpposites - The minor opposite affinities.
      adjacents - The adjacent affinities.
      color - The color of the affinity.
      index - The index of the affinity when displaying in the occulus.
      castSound - The SoundEvent to use for casting spells with the affinity.
      loopSound - The SoundEvent to use for casting continuous spells with the affinity.
      particle - The ParticleOptions to associate with the affinity.
    • Affinity

      public Affinity(net.minecraft.core.Holder<Affinity> directOpposite, List<net.minecraft.core.Holder<Affinity>> majorOpposites, List<net.minecraft.core.Holder<Affinity>> minorOpposites, List<net.minecraft.core.Holder<Affinity>> adjacents, int color, double index, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> castSound, Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> loopSound, net.minecraft.core.particles.ParticleOptions particle)
      Creates an instance of a Affinity record class.
      Parameters:
      directOpposite - the value for the directOpposite record component
      majorOpposites - the value for the majorOpposites record component
      minorOpposites - the value for the minorOpposites record component
      adjacents - the value for the adjacents record component
      color - the value for the color record component
      index - the value for the index record component
      castSound - the value for the castSound record component
      loopSound - the value for the loopSound record component
      particle - the value for the particle record component
  • Method Details

    • toString

      public 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
    • getName

      public static net.minecraft.network.chat.MutableComponent getName(net.minecraft.core.Holder<Affinity> holder)
      Parameters:
      holder - The affinity Holder to query.
      Returns:
      The display name of the given affinity.
    • 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.
    • directOpposite

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

      public List<net.minecraft.core.Holder<Affinity>> majorOpposites()
      Returns the value of the majorOpposites record component.
      Returns:
      the value of the majorOpposites record component
    • minorOpposites

      public List<net.minecraft.core.Holder<Affinity>> minorOpposites()
      Returns the value of the minorOpposites record component.
      Returns:
      the value of the minorOpposites record component
    • adjacents

      public List<net.minecraft.core.Holder<Affinity>> adjacents()
      Returns the value of the adjacents record component.
      Returns:
      the value of the adjacents record component
    • color

      public int color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • index

      public double index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • castSound

      public Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> castSound()
      Returns the value of the castSound record component.
      Returns:
      the value of the castSound record component
    • loopSound

      public Optional<net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>> loopSound()
      Returns the value of the loopSound record component.
      Returns:
      the value of the loopSound record component
    • particle

      public net.minecraft.core.particles.ParticleOptions particle()
      Returns the value of the particle record component.
      Returns:
      the value of the particle record component