Interface Consumable.Builder
- All Superinterfaces:
DataComponentBuilder<Consumable>
- Enclosing interface:
Consumable
@Experimental
@NonExtendable
public static interface Consumable.Builder
extends DataComponentBuilder<Consumable>
Builder for
Consumable.-
Method Summary
Modifier and TypeMethodDescriptionaddEffect(ConsumeEffect effect) Adds a singleConsumeEffectto the consumable item being built.addEffects(List<ConsumeEffect> effects) Adds multipleConsumeEffectinstances to the consumable item being built.animation(ItemUseAnimation animation) Sets the hand animation used when a player consumes the item.consumeSeconds(@org.checkerframework.checker.index.qual.NonNegative float consumeSeconds) Sets the amount of time (in seconds) it takes to consume the item.effects(List<ConsumeEffect> effects) Sets the effects that occur when an item is consumed.hasConsumeParticles(boolean hasConsumeParticles) Sets whether consuming the item results in particle effects.Sets the sound played when consuming the item.Methods inherited from interface io.papermc.paper.datacomponent.DataComponentBuilder
build
-
Method Details
-
consumeSeconds
@Contract(value="_ -> this", mutates="this") Consumable.Builder consumeSeconds(@org.checkerframework.checker.index.qual.NonNegative float consumeSeconds) Sets the amount of time (in seconds) it takes to consume the item.- Parameters:
consumeSeconds- the consumption duration in seconds- Returns:
- the builder for chaining
-
animation
@Contract(value="_ -> this", mutates="this") Consumable.Builder animation(ItemUseAnimation animation) Sets the hand animation used when a player consumes the item.- Parameters:
animation- theItemUseAnimationrepresenting the hand animation to be used- Returns:
- the builder for chaining
-
sound
Sets the sound played when consuming the item.- Parameters:
sound- theKeyrepresenting the sound to be used- Returns:
- the builder for chaining
-
hasConsumeParticles
@Contract(value="_ -> this", mutates="this") Consumable.Builder hasConsumeParticles(boolean hasConsumeParticles) Sets whether consuming the item results in particle effects.- Parameters:
hasConsumeParticles- true to enable particle effects upon consumption, false to disable- Returns:
- the builder for chaining
-
effects
@Contract(value="_ -> this", mutates="this") Consumable.Builder effects(List<ConsumeEffect> effects) Sets the effects that occur when an item is consumed.
Note: this clears any previous effects set.- Parameters:
effects- a list ofConsumeEffectinstances representing the effects to apply upon consumption- Returns:
- the builder for chaining
-
addEffect
Adds a singleConsumeEffectto the consumable item being built.- Parameters:
effect- theConsumeEffectinstance to add- Returns:
- the builder for chaining
-
addEffects
@Contract(value="_ -> this", mutates="this") Consumable.Builder addEffects(List<ConsumeEffect> effects) Adds multipleConsumeEffectinstances to the consumable item being built.- Parameters:
effects- a list ofConsumeEffectinstances to add- Returns:
- the builder for chaining
-