接口 ConsumableComponent

所有超级接口:
ConfigurationSerializable

@Experimental public interface ConsumableComponent extends ConfigurationSerializable
表示一个物品可以在使用时被消耗的组件。
  • 方法详细资料

    • getConsumeSeconds

      float getConsumeSeconds()
      获取消耗此物品所需的时间(以秒为单位)。

      原文:Gets the time in seconds it will take for this item to be consumed.

      返回:
      消耗时间
    • setConsumeSeconds

      void setConsumeSeconds(float consumeSeconds)
      设置消耗此物品所需的时间(以秒为单位)。

      原文:Sets the time in seconds it will take for this item to be consumed.

      参数:
      consumeSeconds - 新的消耗时间
    • getAnimation

      获取消耗物品时使用的动画。

      原文:Gets the animation used during consumption of the item.

      返回:
      动画
    • setAnimation

      void setAnimation(@NotNull @NotNull ConsumableComponent.Animation animation)
      设置消耗物品时使用的动画。

      原文:Sets the animation used during consumption of the item.

      参数:
      animation - 新的动画
    • getSound

      获取在物品消耗期间和完成时播放的音效。

      原文:Gets the sound to play during and on completion of the item's consumption.

      返回:
      音效
    • setSound

      void setSound(@Nullable @Nullable Sound sound)
      设置在物品消耗期间和完成时播放的音效。

      原文:Sets the sound to play during and on completion of the item's consumption.

      参数:
      sound - 音效或null表示使用当前默认值
    • hasConsumeParticles

      boolean hasConsumeParticles()
      获取消耗此物品时是否发射消耗粒子。

      原文:Gets whether consumption particles are emitted while consuming this item.

      返回:
      如果消耗时发射粒子则返回true,否则返回false
    • setConsumeParticles

      void setConsumeParticles(boolean consumeParticles)
      设置消耗此物品时是否发射消耗粒子。

      原文:Sets whether consumption particles are emitted while consuming this item.

      参数:
      consumeParticles - 消耗物品时是否需要发射粒子
    • getEffects

      获取消耗此物品时可能应用的效果。

      原文:Gets the effects which may be applied by this item when consumed.

      返回:
      消耗效果
    • setEffects

      void setEffects(@NotNull @NotNull List<ConsumableEffect> effects)
      设置消耗此物品时可能应用的效果。

      原文:Sets the effects which may be applied by this item when consumed.

      参数:
      effects - 新的效果
    • addEffect

      添加一个消耗此物品时可能应用的效果。

      原文:Adds an effect which may be applied by this item when consumed.

      参数:
      effect - 效果
      返回:
      添加的效果