Record Class SoundContext

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.sound.SoundContext
Record Components:
position - where it plays: a place in the world, or, for a sound relative to the listener, its offset from them
sound - the sound event it plays (as minecraft:entity.zombie.ambient), or null if not known yet
source - its sound category, the one its volume slider is for
relative - whether it plays relative to the listener (music, the menus, a few of the game's own) instead of at a place in the world

public record SoundContext(net.minecraft.world.phys.Vec3 position, @Nullable net.minecraft.resources.ResourceLocation sound, net.minecraft.sounds.SoundSource source, boolean relative) extends Record
A sound a SoundFilterProvider is asked about.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SoundContext(net.minecraft.world.phys.Vec3 position, @Nullable net.minecraft.resources.ResourceLocation sound, net.minecraft.sounds.SoundSource source, boolean relative)
    Creates an instance of a SoundContext record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Whether it plays at a place in the world.
    net.minecraft.world.phys.Vec3
    Returns the value of the position record component.
    boolean
    Returns the value of the relative record component.
    @Nullable net.minecraft.resources.ResourceLocation
    Returns the value of the sound record component.
    net.minecraft.sounds.SoundSource
    Returns the value of the source record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • SoundContext

      public SoundContext(net.minecraft.world.phys.Vec3 position, @Nullable @Nullable net.minecraft.resources.ResourceLocation sound, net.minecraft.sounds.SoundSource source, boolean relative)
      Creates an instance of a SoundContext record class.
      Parameters:
      position - the value for the position record component
      sound - the value for the sound record component
      source - the value for the source record component
      relative - the value for the relative record component
  • Method Details

    • inWorld

      public boolean inWorld()
      Whether it plays at a place in the world.
    • 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.
    • position

      public net.minecraft.world.phys.Vec3 position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • sound

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation sound()
      Returns the value of the sound record component.
      Returns:
      the value of the sound record component
    • source

      public net.minecraft.sounds.SoundSource source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • relative

      public boolean relative()
      Returns the value of the relative record component.
      Returns:
      the value of the relative record component