接口 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
Entity
)。-
方法概要
修饰符和类型方法说明void
damage
(double amount) 给予这个实体一定的伤害.。void
强制某实体伤害这个实体。double
获取当前实体的血量,从0到getMaxHealth()
,当血量为 0 时为死亡状态.。double
已过时。void
已过时。void
setHealth
(double health) 设置这个实体的血量,范围是 0 到getMaxHealth()
,当血量为 0 时为死亡状态。void
setMaxHealth
(double health) 已过时。从接口继承的方法 org.bukkit.command.CommandSender
getName, sendMessage, sendMessage
从接口继承的方法 org.bukkit.entity.Entity
addPassenger, addScoreboardTag, eject, getEntityId, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isOnGround, isSilent, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPortalCooldown, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
从接口继承的方法 org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
从接口继承的方法 org.bukkit.Nameable
getCustomName, setCustomName
从接口继承的方法 org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
从接口继承的方法 org.bukkit.permissions.ServerOperator
isOp, setOp
-
方法详细资料
-
damage
void damage(double amount) 给予这个实体一定的伤害.。原文: Deals the given amount of damage to this entity.
- 参数:
amount
- 伤害的数量
-
damage
强制某实体伤害这个实体。原文: 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
已过时。获取这个实体所能拥有的最大血量。原文: Gets the maximum health this entity has.
- 返回:
- 最大血量
-
setMaxHealth
已过时。设置这个实体所能拥有的最大血量。如果当前血量高于这个值,那么新的血量将会设置为这个值。
Tips: 如果实体有血条,比如(
Player
,EnderDragon
,Wither
, 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
已过时。重置最大血量为 20。原文: Resets the max health to the original amount.
-
Attribute.GENERIC_MAX_HEALTH
.