Record Class Consumable
java.lang.Object
java.lang.Record
net.minestom.server.item.component.Consumable
public record Consumable(float consumeSeconds, ItemAnimation animation, SoundEvent sound, boolean hasConsumeParticles, 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, ItemAnimation animation, SoundEvent sound, boolean hasConsumeParticles, List<ConsumeEffect> effects) Creates an instance of aConsumablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theanimationrecord component.floatReturns the value of theconsumeSecondsrecord component.inteffects()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.sound()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, ItemAnimation animation, SoundEvent sound, boolean hasConsumeParticles, 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
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
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
-