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 soundrelativeto the listener, its offset from themsound- the sound event it plays (asminecraft:entity.zombie.ambient), or null if not known yetsource- its sound category, the one its volume slider is forrelative- 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
ConstructorsConstructorDescriptionSoundContext(net.minecraft.world.phys.Vec3 position, @Nullable net.minecraft.resources.ResourceLocation sound, net.minecraft.sounds.SoundSource source, boolean relative) Creates an instance of aSoundContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleaninWorld()Whether it plays at a place in the world.net.minecraft.world.phys.Vec3position()Returns the value of thepositionrecord component.booleanrelative()Returns the value of therelativerecord component.@Nullable net.minecraft.resources.ResourceLocationsound()Returns the value of thesoundrecord component.net.minecraft.sounds.SoundSourcesource()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
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 aSoundContextrecord class.
-
-
Method Details
-
inWorld
public boolean inWorld()Whether it plays at a place in the world. -
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 '=='. -
position
public net.minecraft.world.phys.Vec3 position()Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
sound
@Nullable public @Nullable net.minecraft.resources.ResourceLocation sound()Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-
source
public net.minecraft.sounds.SoundSource source()Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
relative
public boolean relative()Returns the value of therelativerecord component.- Returns:
- the value of the
relativerecord component
-