Record Class SoundEffect
java.lang.Object
java.lang.Record
net.darkhax.botanypots.common.api.data.SoundEffect
public record SoundEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, float volume, float pitch)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SoundEffect> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, Optional<SoundEffect>> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SoundEffect> -
Constructor Summary
ConstructorsConstructorDescriptionSoundEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, float volume, float pitch) Creates an instance of aSoundEffectrecord 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.floatpitch()Returns the value of thepitchrecord component.voidplaySound(net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player, float x, float y, float z) voidplaySound(net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos) net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound()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.floatvolume()Returns the value of thevolumerecord component.
-
Field Details
-
CODEC
-
STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,SoundEffect> STREAM -
OPTIONAL_STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,Optional<SoundEffect>> OPTIONAL_STREAM
-
-
Constructor Details
-
SoundEffect
public SoundEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, float volume, float pitch) Creates an instance of aSoundEffectrecord class.- Parameters:
sound- the value for thesoundrecord componentsource- the value for thesourcerecord componentvolume- the value for thevolumerecord componentpitch- the value for thepitchrecord component
-
-
Method Details
-
playSound
public void playSound(net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos pos) -
playSound
public void playSound(net.minecraft.server.level.ServerLevel level, net.minecraft.world.entity.player.Player player, float x, float y, float z) -
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 '=='. -
sound
public net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> 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
-
volume
public float volume()Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-
pitch
public float pitch()Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-