Record Class Affinity
java.lang.Object
java.lang.Record
com.github.minecraftschurlimods.arsmagicalegacy.api.affinity.Affinity
- Record Components:
color- The color for this affinity.minorOpposites- The minor opposing affinities for this affinity.majorOpposites- The major opposing affinities for this affinity.directOpposite- The direct opposing affinity for this affinity.castSound- The sound to play when casting a spell with this affinity.loopSound- The sound to play when casting a continuous spell with this affinity.particle- The particle type associated with this affinity.
- All Implemented Interfaces:
ITranslatable,Comparable<Affinity>
public record Affinity(int color, Set<net.minecraft.resources.ResourceLocation> minorOpposites, Set<net.minecraft.resources.ResourceLocation> majorOpposites, net.minecraft.resources.ResourceLocation directOpposite, Supplier<net.minecraft.sounds.SoundEvent> castSound, Supplier<net.minecraft.sounds.SoundEvent> loopSound, Supplier<? extends net.minecraft.core.particles.ParticleOptions> particle)
extends Record
implements Comparable<Affinity>, ITranslatable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.github.minecraftschurlimods.arsmagicalegacy.api.util.ITranslatable
ITranslatable.WithDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<Affinity>>static final net.minecraft.resources.ResourceLocation -
Constructor Summary
ConstructorsConstructorDescriptionAffinity(int color, Set<net.minecraft.resources.ResourceLocation> minorOpposites, Set<net.minecraft.resources.ResourceLocation> majorOpposites, net.minecraft.resources.ResourceLocation directOpposite, Supplier<net.minecraft.sounds.SoundEvent> castSound, Supplier<net.minecraft.sounds.SoundEvent> loopSound, Supplier<? extends net.minecraft.core.particles.ParticleOptions> particle) Creates an instance of aAffinityrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic Affinity.Builderbuilder()Supplier<net.minecraft.sounds.SoundEvent>Returns the value of thecastSoundrecord component.intcolor()Returns the value of thecolorrecord component.intnet.minecraft.resources.ResourceLocationReturns the value of thedirectOppositerecord component.final booleanIndicates whether some other object is "equal to" this one.Set<net.minecraft.resources.ResourceLocation>@Nullable net.minecraft.sounds.SoundEventnet.minecraft.resources.ResourceLocationgetId()@Nullable net.minecraft.sounds.SoundEvent@Nullable net.minecraft.core.particles.ParticleOptionsgetType()final inthashCode()Returns a hash code value for this object.Supplier<net.minecraft.sounds.SoundEvent>Returns the value of theloopSoundrecord component.@Unmodifiable Set<net.minecraft.resources.ResourceLocation>Returns the value of themajorOppositesrecord component.@Unmodifiable Set<net.minecraft.resources.ResourceLocation>Returns the value of theminorOppositesrecord component.Supplier<? extends net.minecraft.core.particles.ParticleOptions>particle()Returns the value of theparticlerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.minecraftschurlimods.arsmagicalegacy.api.util.ITranslatable
getDisplayName, getDisplayName, getId, getTranslationKey, getTranslationKey
-
Field Details
-
AFFINITY
- See Also:
-
REGISTRY_KEY
public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<Affinity>> REGISTRY_KEY -
NONE
public static final net.minecraft.resources.ResourceLocation NONE -
ARCANE
public static final net.minecraft.resources.ResourceLocation ARCANE -
WATER
public static final net.minecraft.resources.ResourceLocation WATER -
FIRE
public static final net.minecraft.resources.ResourceLocation FIRE -
EARTH
public static final net.minecraft.resources.ResourceLocation EARTH -
AIR
public static final net.minecraft.resources.ResourceLocation AIR -
LIGHTNING
public static final net.minecraft.resources.ResourceLocation LIGHTNING -
ICE
public static final net.minecraft.resources.ResourceLocation ICE -
NATURE
public static final net.minecraft.resources.ResourceLocation NATURE -
LIFE
public static final net.minecraft.resources.ResourceLocation LIFE -
ENDER
public static final net.minecraft.resources.ResourceLocation ENDER
-
-
Constructor Details
-
Affinity
public Affinity(int color, Set<net.minecraft.resources.ResourceLocation> minorOpposites, Set<net.minecraft.resources.ResourceLocation> majorOpposites, net.minecraft.resources.ResourceLocation directOpposite, Supplier<net.minecraft.sounds.SoundEvent> castSound, Supplier<net.minecraft.sounds.SoundEvent> loopSound, Supplier<? extends net.minecraft.core.particles.ParticleOptions> particle) Creates an instance of aAffinityrecord class.- Parameters:
color- the value for thecolorrecord componentminorOpposites- the value for theminorOppositesrecord componentmajorOpposites- the value for themajorOppositesrecord componentdirectOpposite- the value for thedirectOppositerecord componentcastSound- the value for thecastSoundrecord componentloopSound- the value for theloopSoundrecord componentparticle- the value for theparticlerecord component
-
-
Method Details
-
builder
- Returns:
- A new affinity builder.
-
minorOpposites
Returns the value of theminorOppositesrecord component.- Returns:
- the value of the
minorOppositesrecord component
-
majorOpposites
Returns the value of themajorOppositesrecord component.- Returns:
- the value of the
majorOppositesrecord component
-
getAdjacentAffinities
- Returns:
- The adjacent affinities for this affinity.
-
getCastSound
@Nullable public @Nullable net.minecraft.sounds.SoundEvent getCastSound()- Returns:
- The sound that should be played when casting a spell with this affinity.
-
getLoopSound
@Nullable public @Nullable net.minecraft.sounds.SoundEvent getLoopSound()- Returns:
- The sound that should be played when casting a continuous spell with this affinity.
-
getParticle
@Nullable public @Nullable net.minecraft.core.particles.ParticleOptions getParticle()- Returns:
- The sound that should be played when casting a continuous spell with this affinity.
-
getType
- Specified by:
getTypein interfaceITranslatable- Returns:
- The type of this object, for example "block" or "item".
-
getId
public net.minecraft.resources.ResourceLocation getId()- Specified by:
getIdin interfaceITranslatable- Returns:
- The id of this object.
-
compareTo
- Specified by:
compareToin interfaceComparable<Affinity>
-
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 '=='. -
color
public int color()Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
directOpposite
public net.minecraft.resources.ResourceLocation directOpposite()Returns the value of thedirectOppositerecord component.- Returns:
- the value of the
directOppositerecord component
-
castSound
Returns the value of thecastSoundrecord component.- Returns:
- the value of the
castSoundrecord component
-
loopSound
Returns the value of theloopSoundrecord component.- Returns:
- the value of the
loopSoundrecord component
-
particle
Returns the value of theparticlerecord component.- Returns:
- the value of the
particlerecord component
-