Interface JavaConsumable
public interface JavaConsumable
The consumable component is used to mark
an item as consumable. Further, it allows specifying
the consume duration and animation to play when consuming.
- Since:
- 2.9.3
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumNot all animations work perfectly on bedrock.static interfaceBuilder for the consumable component. -
Method Summary
Modifier and TypeMethodDescription@NonNull JavaConsumable.AnimationThe animation that should play when consuming the item.static @NonNull JavaConsumable.Builderbuilder()Creates a builder for the consumable component.@org.checkerframework.checker.index.qual.Positive floatThe seconds it takes to consume the item.static @NonNull JavaConsumableof(float consumeSeconds, JavaConsumable.Animation animation) Creates a consumable component.
-
Method Details
-
consumeSeconds
@org.checkerframework.checker.index.qual.Positive float consumeSeconds()The seconds it takes to consume the item. This it the amount of time the animation will play for. Defaults to1.6.- Returns:
- the consume duration, in seconds
- Since:
- 2.9.3
-
animation
@NonNull JavaConsumable.Animation animation()The animation that should play when consuming the item. Defaults toJavaConsumable.Animation.EAT.- Returns:
- the animation to play
- Since:
- 2.9.3
-
builder
Creates a builder for the consumable component.- Returns:
- a new builder
- Since:
- 2.9.3
-
of
Creates a consumable component.- Parameters:
consumeSeconds- the consume duration, in secondsanimation- the animation to play when consuming- Returns:
- the consumable component
- Since:
- 2.9.3
-