Record Class PlaySoundConsumeEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect
- All Implemented Interfaces:
ConsumeEffect
public record PlaySoundConsumeEffect(Holder<SoundEvent> sound)
extends Record
implements ConsumeEffect
-
Nested Class Summary
Nested classes/interfaces inherited from interface ConsumeEffect
ConsumeEffect.Type<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PlaySoundConsumeEffect> private final Holder<SoundEvent> The field for thesoundrecord component.static final StreamCodec<RegistryFriendlyByteBuf, PlaySoundConsumeEffect> -
Constructor Summary
ConstructorsConstructorDescriptionPlaySoundConsumeEffect(Holder<SoundEvent> sound) Creates an instance of aPlaySoundConsumeEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Level level, ItemStack stack, LivingEntity user) final booleanIndicates whether some other object is "equal to" this one.getType()final inthashCode()Returns a hash code value for this object.sound()Returns the value of thesoundrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
sound
The field for thesoundrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
PlaySoundConsumeEffect
Creates an instance of aPlaySoundConsumeEffectrecord class.- Parameters:
sound- the value for thesoundrecord component
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceConsumeEffect
-
apply
- Specified by:
applyin interfaceConsumeEffect
-
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
Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-