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 net.minecraft.world.item.consume_effects.ConsumeEffect
ConsumeEffect.Type<T extends ConsumeEffect> -
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 pLevel, ItemStack pStack, LivingEntity pEntity) 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
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). -
sound
Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-