public interface Damageable extends Entity
Entity)。| 限定符和类型 | 方法和说明 |
|---|---|
void |
damage(double amount)
给予这个实体一定的伤害.。
|
void |
damage(double amount,
Entity source)
强制某实体伤害这个实体。
|
double |
getHealth()
获取当前实体的血量,从0到
getMaxHealth(),当血量为 0 时为死亡状态.。 |
double |
getMaxHealth()
已过时。
|
void |
resetMaxHealth()
已过时。
|
void |
setHealth(double health)
设置这个实体的血量,范围是 0 到
getMaxHealth(),当血量为 0 时为死亡状态。 |
void |
setMaxHealth(double health)
已过时。
|
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, teleportgetMetadata, hasMetadata, removeMetadata, setMetadatagetName, sendMessage, sendMessageaddAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachmentisOp, setOpgetCustomName, setCustomNamevoid damage(double amount)
原文: Deals the given amount of damage to this entity.
amount - 伤害的数量void damage(double amount,
Entity source)
原文: Deals the given amount of damage to this entity, from a specified entity.
amount - 伤害的数量source - 伤害来源double getHealth()
getMaxHealth(),当血量为 0 时为死亡状态.。
原文: Gets the entity's health from 0 to getMaxHealth(),
where 0 is dead.
void setHealth(double health)
getMaxHealth(),当血量为 0 时为死亡状态。
原文: Sets the entity's health from 0 to
getMaxHealth(), where 0 is dead.
health - 新的血量,范围是 0 到最大.java.lang.IllegalArgumentException - Thrown if the health is < 0 or >
getMaxHealth()@Deprecated double getMaxHealth()
Attribute.GENERIC_MAX_HEALTH.原文: Gets the maximum health this entity has.
@Deprecated void setMaxHealth(double health)
Attribute.GENERIC_MAX_HEALTH.如果当前血量高于这个值,那么新的血量将会设置为这个值。
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@Deprecated void resetMaxHealth()
Attribute.GENERIC_MAX_HEALTH.原文: Resets the max health to the original amount.