接口 Firework

所有超级接口:
CommandSender, Entity, Metadatable, Nameable, Permissible, PersistentDataHolder, Projectile, ServerOperator

public interface Firework extends Projectile
烟花火箭实体.
  • 方法详细资料

    • getFireworkMeta

      @NotNull @NotNull FireworkMeta getFireworkMeta()
      获取烟花火箭元数据的副本.

      原文:Get a copy of the fireworks meta

      返回:
      烟花火箭元数据的副本
    • setFireworkMeta

      void setFireworkMeta(@NotNull @NotNull FireworkMeta meta)
      为此烟花火箭应用提供的烟花火箭元数据.

      原文:Apply the provided meta to the fireworks

      参数:
      meta - 要应用的 FireworkMeta
    • setAttachedTo

      boolean setAttachedTo(@Nullable @Nullable LivingEntity entity)
      设置此烟花火箭附着的 LivingEntity.

      当附着到实体时, 烟花效果将正常作用但保持在实体位置. 如果实体 LivingEntity#isGliding() 正在滑翔, 则实体将获得朝向其视线方向的推进力.

      原文:Set the LivingEntity to which this firework is attached.

      When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity LivingEntity#isGliding() is gliding, then the entity will receive a boost in the direction that they are looking.

      参数:
      entity - 烟花应附着的实体, 或 null 以移除附着的实体
      返回:
      如果实体可以附着则为 true, 如果烟花已经引爆则为 false
    • getAttachedTo

      获取此烟花火箭附着的 LivingEntity.

      当附着到实体时, 烟花效果将正常作用但保持在实体位置. 如果实体 LivingEntity#isGliding() 正在滑翔, 则实体将获得朝向其视线方向的推进力.

      原文:Get the LivingEntity to which this firework is attached.

      When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity LivingEntity#isGliding() is gliding, then the entity will receive a boost in the direction that they are looking.

      返回:
      附着的实体, 如果没有则为 null
    • setLife

      boolean setLife(int ticks)
      设置此烟花火箭已存活的 tick 数. 如果此值超过 getMaxLife(), 烟花将引爆.

      原文:Set the ticks that this firework has been alive. If this value exceeds getMaxLife(), the firework will detonate.

      参数:
      ticks - 要设置的 tick 数. 必须大于或等于 0
      返回:
      如果设置成功则为 true, 如果烟花已经引爆则为 false
    • getLife

      int getLife()
      获取此烟花火箭已存活的 tick 数. 当此值达到 getMaxLife() 时, 烟花将引爆.

      原文:Get the ticks that this firework has been alive. When this value reaches getMaxLife(), the firework will detonate.

      返回:
      存活 tick 数
    • setMaxLife

      boolean setMaxLife(int ticks)
      设置此烟花火箭在引爆前存在的时间 (以 tick 为单位).

      原文:Set the time in ticks this firework will exist until it is detonated.

      参数:
      ticks - 要设置的 tick 数. 必须大于 0
      返回:
      如果设置成功则为 true, 如果烟花已经引爆则为 false
    • getMaxLife

      int getMaxLife()
      获取此烟花火箭在引爆前存在的时间 (以 tick 为单位).

      原文:Get the time in ticks this firework will exist until it is detonated.

      返回:
      最大存活时间 (以 tick 为单位)
    • detonate

      void detonate()
      使烟花尽早爆炸, 像是它的引火线已燃烧殆尽.

      原文:Cause this firework to explode at earliest opportunity, as if it has no remaining fuse.

    • isDetonated

      boolean isDetonated()
      检查此烟花是否已经引爆.

      原文:Check whether or not this firework has detonated.

      返回:
      如果已引爆则为 true, 如果仍在世界中则为 false
    • isShotAtAngle

      boolean isShotAtAngle()
      获取此烟花是否以一定角度发射 (比如使用弩). 若此值为false, 烟花将以垂直向上的方向飞行.

      原文:Gets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.

      返回:
      此烟花是否以一定角度发射
    • setShotAtAngle

      void setShotAtAngle(boolean shotAtAngle)
      设置此烟花是否以一定角度发射 (比如使用弩). 若设置此值为false, 烟花将以垂直向上的方向飞行.

      原文:Sets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.

      参数:
      shotAtAngle - 此烟花是否以一定角度发射