Record Class PlaySoundEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.PlaySoundEffect
- All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect
public record PlaySoundEffect(List<Holder<SoundEvent>> soundEvents, 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 List<Holder<SoundEvent>> The field for thesoundEventsrecord component.private final FloatProviderThe field for thevolumerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionPlaySoundEffect(List<Holder<SoundEvent>> soundEvents, FloatProvider volume, FloatProvider pitch) Creates an instance of aPlaySoundEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) 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 thesoundEventsrecord component.final StringtoString()Returns a string representation of this record class.volume()Returns the value of thevolumerecord component.Methods inherited from interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
soundEvents
The field for thesoundEventsrecord component. -
volume
The field for thevolumerecord component. -
pitch
The field for thepitchrecord component. -
CODEC
-
-
Constructor Details
-
PlaySoundEffect
public PlaySoundEffect(List<Holder<SoundEvent>> soundEvents, FloatProvider volume, FloatProvider pitch) Creates an instance of aPlaySoundEffectrecord class.- Parameters:
soundEvents- the value for thesoundEventsrecord componentvolume- the value for thevolumerecord componentpitch- the value for thepitchrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
toString
-
hashCode
-
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). -
soundEvents
Returns the value of thesoundEventsrecord component.- Returns:
- the value of the
soundEventsrecord 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
-