Record Class Consumable
java.lang.Object
java.lang.Record
net.minestom.server.item.component.Consumable
public record Consumable(float consumeSeconds, @NotNull ItemAnimation animation, @NotNull SoundEvent sound, boolean hasConsumeParticles, @NotNull List<ConsumeEffect> effects)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<Consumable> static final floatstatic final NetworkBuffer.Type<Consumable> -
Constructor Summary
ConstructorsConstructorDescriptionConsumable(float consumeSeconds, @NotNull ItemAnimation animation, @NotNull SoundEvent sound, boolean hasConsumeParticles, @NotNull List<ConsumeEffect> effects) Creates an instance of aConsumablerecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemAnimationReturns the value of theanimationrecord component.floatReturns the value of theconsumeSecondsrecord component.int@NotNull List<ConsumeEffect> effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasConsumeParticlesrecord component.final inthashCode()Returns a hash code value for this object.@NotNull SoundEventsound()Returns the value of thesoundrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_CONSUME_SECONDS
public static final float DEFAULT_CONSUME_SECONDS- See Also:
-
NETWORK_TYPE
-
CODEC
-
-
Constructor Details
-
Consumable
public Consumable(float consumeSeconds, @NotNull @NotNull ItemAnimation animation, @NotNull @NotNull SoundEvent sound, boolean hasConsumeParticles, @NotNull @NotNull List<ConsumeEffect> effects) Creates an instance of aConsumablerecord class.- Parameters:
consumeSeconds- the value for theconsumeSecondsrecord componentanimation- the value for theanimationrecord componentsound- the value for thesoundrecord componenthasConsumeParticles- the value for thehasConsumeParticlesrecord componenteffects- the value for theeffectsrecord component
-
-
Method Details
-
consumeTicks
public int consumeTicks() -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
consumeSeconds
public float consumeSeconds()Returns the value of theconsumeSecondsrecord component.- Returns:
- the value of the
consumeSecondsrecord component
-
animation
Returns the value of theanimationrecord component.- Returns:
- the value of the
animationrecord component
-
sound
Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-
hasConsumeParticles
public boolean hasConsumeParticles()Returns the value of thehasConsumeParticlesrecord component.- Returns:
- the value of the
hasConsumeParticlesrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-