接口 Damageable

所有超级接口:
CommandSender, Entity, Metadatable, Nameable, Permissible, ServerOperator
所有已知子接口:
AbstractHorse, Ageable, Ambient, Animals, ArmorStand, Bat, Blaze, CaveSpider, ChestedHorse, Chicken, ComplexLivingEntity, Cow, Creature, Creeper, Donkey, ElderGuardian, EnderDragon, EnderDragonPart, Enderman, Endermite, Evoker, Flying, Ghast, Giant, Golem, Guardian, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, LivingEntity, Llama, MagmaCube, Monster, Mule, MushroomCow, NPC, Ocelot, Parrot, Pig, PigZombie, Player, PolarBear, Rabbit, Sheep, Shulker, Silverfish, Skeleton, SkeletonHorse, Slime, Snowman, Spellcaster, Spider, Squid, Stray, Vex, Villager, Vindicator, WaterMob, Witch, Wither, WitherSkeleton, Wolf, Zombie, ZombieHorse, ZombieVillager

public interface Damageable extends Entity
表示一个有生命值和可以被伤害的实体(Entity)。
  • 方法详细资料

    • damage

      void damage(double amount)
      给予这个实体一定的伤害.。

      原文: Deals the given amount of damage to this entity.

      参数:
      amount - 伤害的数量
    • damage

      void damage(double amount, Entity source)
      强制某实体伤害这个实体。

      原文: Deals the given amount of damage to this entity, from a specified entity.

      参数:
      amount - 伤害的数量
      source - 伤害来源
    • getHealth

      double getHealth()
      获取当前实体的血量,从0到 getMaxHealth(),当血量为 0 时为死亡状态.。

      原文: Gets the entity's health from 0 to getMaxHealth(), where 0 is dead.

      返回:
      玩家血量,范围是0到最大
    • setHealth

      void setHealth(double health)
      设置这个实体的血量,范围是 0 到 getMaxHealth(),当血量为 0 时为死亡状态。

      原文: Sets the entity's health from 0 to getMaxHealth(), where 0 is dead.

      参数:
      health - 新的血量,范围是 0 到最大.
      抛出:
      IllegalArgumentException - Thrown if the health is < 0 or > getMaxHealth()
    • getMaxHealth

      @Deprecated double getMaxHealth()
      已过时。
      获取这个实体所能拥有的最大血量。

      原文: Gets the maximum health this entity has.

      返回:
      最大血量
    • setMaxHealth

      @Deprecated void setMaxHealth(double health)
      已过时。
      设置这个实体所能拥有的最大血量。

      如果当前血量高于这个值,那么新的血量将会设置为这个值。

      Tips: 如果实体有血条,比如(PlayerEnderDragonWither, etc...} 也将会有他们相应的血条样式。

      原文: Sets the maximum health this entity can have.

      If the health of the entity is above the value provided it will be set to that value.

      Note: An entity with a health bar (Player, EnderDragon, Wither, etc...} will have their bar scaled accordingly.

      参数:
      health - amount of health to set the maximum to
    • resetMaxHealth

      @Deprecated void resetMaxHealth()
      已过时。
      重置最大血量为 20。

      原文: Resets the max health to the original amount.