Interface Consumable.Builder

All Superinterfaces:
DataComponentBuilder<Consumable>
Enclosing interface:
Consumable

@Experimental @NonExtendable public static interface Consumable.Builder extends DataComponentBuilder<Consumable>
Builder for Consumable.
  • 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 - the ItemUseAnimation representing the hand animation to be used
      Returns:
      the builder for chaining
    • sound

      @Contract(value="_ -> this", mutates="this") Consumable.Builder sound(Key sound)
      Sets the sound played when consuming the item.
      Parameters:
      sound - the Key representing 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 of ConsumeEffect instances representing the effects to apply upon consumption
      Returns:
      the builder for chaining
    • addEffect

      @Contract(value="_ -> this", mutates="this") Consumable.Builder addEffect(ConsumeEffect effect)
      Adds a single ConsumeEffect to the consumable item being built.
      Parameters:
      effect - the ConsumeEffect instance to add
      Returns:
      the builder for chaining
    • addEffects

      @Contract(value="_ -> this", mutates="this") Consumable.Builder addEffects(List<ConsumeEffect> effects)
      Adds multiple ConsumeEffect instances to the consumable item being built.
      Parameters:
      effects - a list of ConsumeEffect instances to add
      Returns:
      the builder for chaining