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
Modifier and TypeFieldDescriptionstatic final float
static final BinaryTagSerializer
<Consumable> static final NetworkBuffer.Type
<Consumable> -
Constructor Summary
ConstructorDescriptionConsumable
(float consumeSeconds, @NotNull ItemAnimation animation, @NotNull SoundEvent sound, boolean hasConsumeParticles, @NotNull List<ConsumeEffect> effects) Creates an instance of aConsumable
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemAnimation
Returns the value of theanimation
record component.float
Returns the value of theconsumeSeconds
record component.int
@NotNull List
<ConsumeEffect> effects()
Returns the value of theeffects
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of thehasConsumeParticles
record component.final int
hashCode()
Returns a hash code value for this object.@NotNull SoundEvent
sound()
Returns the value of thesound
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
DEFAULT_CONSUME_SECONDS
public static final float DEFAULT_CONSUME_SECONDS- See Also:
-
NETWORK_TYPE
-
NBT_TYPE
-
-
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 aConsumable
record class.- Parameters:
consumeSeconds
- the value for theconsumeSeconds
record componentanimation
- the value for theanimation
record componentsound
- the value for thesound
record componenthasConsumeParticles
- the value for thehasConsumeParticles
record componenteffects
- the value for theeffects
record 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 theconsumeSeconds
record component.- Returns:
- the value of the
consumeSeconds
record component
-
animation
Returns the value of theanimation
record component.- Returns:
- the value of the
animation
record component
-
sound
Returns the value of thesound
record component.- Returns:
- the value of the
sound
record component
-
hasConsumeParticles
public boolean hasConsumeParticles()Returns the value of thehasConsumeParticles
record component.- Returns:
- the value of the
hasConsumeParticles
record component
-
effects
Returns the value of theeffects
record component.- Returns:
- the value of the
effects
record component
-