Record Class PlaySoundBlockEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.audio.PlaySoundBlockEffect
- Record Components:
sound- The registryHolderof theSoundEventto play.source- TheSoundSourcecategory channel through which the sound is played.volume- TheLevelBasedValuebase volume multiplier (further attenuated by the block's topological scalar).pitch- TheLevelBasedValuepitch multiplier applied to the sound event.
- All Implemented Interfaces:
SpellFieldBlockEffect, SpellFieldEffect
public record PlaySoundBlockEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, net.minecraft.world.item.enchantment.LevelBasedValue volume, net.minecraft.world.item.enchantment.LevelBasedValue pitch)
extends Record
implements SpellFieldBlockEffect
A
SpellFieldBlockEffect that broadcasts a configured SoundEvent centered at each
evaluated block coordinate within a spell field volume, scaling the output volume by the block's
local topological multiplier.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PlaySoundBlockEffect> MapCodec for serializing and deserializingPlaySoundBlockEffectinstances from JSON.static final StringRegistry path identifier for this spell field block effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the sound pitch multiplier.static final StringJSON field key for the sound event identifier.static final StringJSON field key for the sound source category.static final com.mojang.serialization.Codec<net.minecraft.sounds.SoundSource> Case-insensitive string codec for resolvingSoundSourceconstants by name, defaulting toSoundSource.PLAYERSif unrecognized.static final StringJSON field key for the base sound volume. -
Constructor Summary
ConstructorsConstructorDescriptionPlaySoundBlockEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, net.minecraft.world.item.enchantment.LevelBasedValue volume, net.minecraft.world.item.enchantment.LevelBasedValue pitch) Creates an instance of aPlaySoundBlockEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.core.BlockPos pos, float scalar, Set<net.minecraft.core.BlockPos> modifiedBlocks) Broadcasts the configured sound event at the center ofposif the effective volume ($\text{volume} \cdot \text{scalar}$) exceeds0.01F.com.mojang.serialization.MapCodec<? extends SpellFieldBlockEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValuepitch()Returns the value of thepitchrecord component.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.net.minecraft.world.item.enchantment.LevelBasedValuevolume()Returns the value of thevolumerecord component.Methods inherited from interface SpellFieldBlockEffect
getPriority
-
Field Details
-
SOUND
-
SOURCE
-
VOLUME
-
PITCH
-
KEY
Registry path identifier for this spell field block effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
SOURCE_CODEC
public static final com.mojang.serialization.Codec<net.minecraft.sounds.SoundSource> SOURCE_CODECCase-insensitive string codec for resolvingSoundSourceconstants by name, defaulting toSoundSource.PLAYERSif unrecognized. -
CODEC
MapCodec for serializing and deserializingPlaySoundBlockEffectinstances from JSON.
-
-
Constructor Details
-
PlaySoundBlockEffect
public PlaySoundBlockEffect(net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, net.minecraft.world.item.enchantment.LevelBasedValue volume, net.minecraft.world.item.enchantment.LevelBasedValue pitch) Creates an instance of aPlaySoundBlockEffectrecord class.
-
-
Method Details
-
apply
public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.core.BlockPos pos, float scalar, Set<net.minecraft.core.BlockPos> modifiedBlocks) Broadcasts the configured sound event at the center ofposif the effective volume ($\text{volume} \cdot \text{scalar}$) exceeds0.01F.- Specified by:
applyin interfaceSpellFieldBlockEffect- Parameters:
level- The executing server level.enchantmentLevel- The active level of the spell field enchantment.context- The item usage context triggering the spell field.spatialReference- The anchor entity or focal point of the spell field.epicenter- The exact spatial origin vector of the spell field.pos- The target block coordinate.scalar- The active topological multiplier atpos.modifiedBlocks- A mutable set tracking block coordinates modified during this evaluation cycle.
-
codec
Description copied from interface:SpellFieldEffectRetrieves theMapCodecresponsible for serializing and deserializing this effect.- Specified by:
codecin interfaceSpellFieldEffect- Returns:
- The registered
MapCodecinstance.
-
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). -
sound
-
source
-
volume
-
pitch
-