接口 Damageable
- 所有超级接口:
CommandSender
,Entity
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,ServerOperator
- 所有已知子接口:
AbstractHorse
,AbstractSkeleton
,AbstractVillager
,Ageable
,Allay
,Ambient
,Animals
,Armadillo
,ArmorStand
,Axolotl
,Bat
,Bee
,Blaze
,Bogged
,Breedable
,Breeze
,Camel
,Cat
,CaveSpider
,ChestedHorse
,Chicken
,Cod
,ComplexLivingEntity
,Cow
,Creature
,Creeper
,Dolphin
,Donkey
,Drowned
,ElderGuardian
,EnderDragon
,EnderDragonPart
,Enderman
,Endermite
,Enemy
,Evoker
,Fish
,Flying
,Fox
,Frog
,Ghast
,Giant
,GlowSquid
,Goat
,Golem
,Guardian
,Hoglin
,Horse
,HumanEntity
,Husk
,Illager
,Illusioner
,IronGolem
,LivingEntity
,Llama
,MagmaCube
,Mob
,Monster
,Mule
,MushroomCow
,NPC
,Ocelot
,Panda
,Parrot
,Phantom
,Pig
,Piglin
,PiglinAbstract
,PiglinBrute
,PigZombie
,Pillager
,Player
,PolarBear
,PufferFish
,Rabbit
,Raider
,Ravager
,Salmon
,Sheep
,Shulker
,Silverfish
,Skeleton
,SkeletonHorse
,Slime
,Sniffer
,Snowman
,Spellcaster
,Spider
,Squid
,Steerable
,Stray
,Strider
,Tadpole
,Tameable
,TraderLlama
,TropicalFish
,Turtle
,Vex
,Villager
,Vindicator
,WanderingTrader
,Warden
,WaterMob
,Witch
,Wither
,WitherSkeleton
,Wolf
,Zoglin
,Zombie
,ZombieHorse
,ZombieVillager
Entity
)。-
嵌套类概要
从接口继承的嵌套类/接口 org.bukkit.entity.Entity
Entity.Spigot
-
方法概要
修饰符和类型方法说明void
damage
(double amount) 给予这个实体一定的伤害.void
damage
(double amount, @NotNull DamageSource damageSource) Deals the given amount of damage to this entity from a specifiedDamageSource
.void
强制某实体伤害这个实体
.double
Gets the entity's absorption amount.double
获取当前实体的血量,从0到getMaxHealth()
,当血量为 0 时为死亡状态.。double
已过时。void
已过时。void
setAbsorptionAmount
(double amount) Sets the entity's absorption amount.void
setHealth
(double health) 设置这个实体的血量,范围是 0 到getMaxHealth()
,当血量为 0 时为死亡状态。void
setMaxHealth
(double health) 已过时。从接口继承的方法 org.bukkit.command.CommandSender
getName, sendMessage, sendMessage, sendMessage, sendMessage
从接口继承的方法 org.bukkit.entity.Entity
addPassenger, addScoreboardTag, copy, copy, createSnapshot, eject, getAsString, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isInWorld, isOnGround, isPersistent, isSilent, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spigot, 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.persistence.PersistentDataHolder
getPersistentDataContainer
从接口继承的方法 org.bukkit.permissions.ServerOperator
isOp, setOp
-
方法详细资料
-
damage
void damage(double amount) 给予这个实体一定的伤害.原文: Deals the given amount of damage to this entity.
- 参数:
amount
- 伤害的数量
-
damage
- 参数:
amount
- 伤害的数量source
- 伤害来源
-
damage
Deals the given amount of damage to this entity from a specifiedDamageSource
.- 参数:
amount
- amount of damage to dealdamageSource
- source to which the damage should be attributed
-
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()
-
getAbsorptionAmount
double getAbsorptionAmount()Gets the entity's absorption amount.- 返回:
- absorption amount from 0
-
setAbsorptionAmount
void setAbsorptionAmount(double amount) Sets the entity's absorption amount.Note: The amount is capped to the value of
Attribute.GENERIC_MAX_ABSORPTION
. The effect of this method on that attribute is currently unspecified and subject to change.- 参数:
amount
- new absorption amount from 0- 抛出:
IllegalArgumentException
- thrown if health is < 0 or non-finite.
-
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
.