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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<PlaySoundEffect> private final FloatProvider
The field for thepitch
record component.private final Holder
<SoundEvent> The field for thesoundEvent
record component.private final FloatProvider
The field for thevolume
record component. -
Constructor Summary
ConstructorDescriptionPlaySoundEffect
(Holder<SoundEvent> soundEvent, FloatProvider volume, FloatProvider pitch) Creates an instance of aPlaySoundEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(ServerLevel p_344971_, int p_344872_, EnchantedItemInUse p_345016_, Entity p_346106_, Vec3 p_345017_) com.mojang.serialization.MapCodec
<PlaySoundEffect> codec()
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.pitch()
Returns the value of thepitch
record component.Returns the value of thesoundEvent
record component.final String
toString()
Returns a string representation of this record class.volume()
Returns the value of thevolume
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlock
Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
soundEvent
The field for thesoundEvent
record component. -
volume
The field for thevolume
record component. -
pitch
The field for thepitch
record component. -
CODEC
-
-
Constructor Details
-
PlaySoundEffect
Creates an instance of aPlaySoundEffect
record class.- Parameters:
soundEvent
- the value for thesoundEvent
record componentvolume
- the value for thevolume
record componentpitch
- the value for thepitch
record component
-
-
Method Details
-
apply
public void apply(ServerLevel p_344971_, int p_344872_, EnchantedItemInUse p_345016_, Entity p_346106_, Vec3 p_345017_) - Specified by:
apply
in interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codec
in interfaceEnchantmentEntityEffect
- Specified by:
codec
in 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 thesoundEvent
record component.- Returns:
- the value of the
soundEvent
record component
-
volume
Returns the value of thevolume
record component.- Returns:
- the value of the
volume
record component
-
pitch
Returns the value of thepitch
record component.- Returns:
- the value of the
pitch
record component
-