Record Class PlaySoundEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.PlaySoundEffect
- All Implemented Interfaces:
EnchantmentEntityEffect,EnchantmentLocationBasedEffect
public record PlaySoundEffect(Holder<SoundEvent> soundEvent, FloatProvider volume, FloatProvider pitch)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PlaySoundEffect> private final FloatProviderThe field for thepitchrecord component.private final Holder<SoundEvent> The field for thesoundEventrecord component.private final FloatProviderThe field for thevolumerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionPlaySoundEffect(Holder<SoundEvent> soundEvent, FloatProvider volume, FloatProvider pitch) Creates an instance of aPlaySoundEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel p_344971_, int p_344872_, EnchantedItemInUse p_345016_, Entity p_346106_, Vec3 p_345017_) com.mojang.serialization.MapCodec<PlaySoundEffect> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.pitch()Returns the value of thepitchrecord component.Returns the value of thesoundEventrecord component.final StringtoString()Returns a string representation of this record class.volume()Returns the value of thevolumerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
soundEvent
The field for thesoundEventrecord component. -
volume
The field for thevolumerecord component. -
pitch
The field for thepitchrecord component. -
CODEC
-
-
Constructor Details
-
PlaySoundEffect
Creates an instance of aPlaySoundEffectrecord class.- Parameters:
soundEvent- the value for thesoundEventrecord componentvolume- the value for thevolumerecord componentpitch- the value for thepitchrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel p_344971_, int p_344872_, EnchantedItemInUse p_345016_, Entity p_346106_, Vec3 p_345017_) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
soundEvent
Returns the value of thesoundEventrecord component.- Returns:
- the value of the
soundEventrecord component
-
volume
Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-
pitch
Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-