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 thesound
record component.static final StreamCodec
<RegistryFriendlyByteBuf, PlaySoundConsumeEffect> -
Constructor Summary
ConstructorsConstructorDescriptionPlaySoundConsumeEffect
(Holder<SoundEvent> sound) Creates an instance of aPlaySoundConsumeEffect
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(Level p_366628_, ItemStack p_366717_, LivingEntity p_366700_) final boolean
Indicates whether some other object is "equal to" this one.getType()
final int
hashCode()
Returns a hash code value for this object.sound()
Returns the value of thesound
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
sound
The field for thesound
record component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
PlaySoundConsumeEffect
Creates an instance of aPlaySoundConsumeEffect
record class.- Parameters:
sound
- the value for thesound
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceConsumeEffect
-
apply
- Specified by:
apply
in 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 thesound
record component.- Returns:
- the value of the
sound
record component
-