Package org.bukkit.entity
Interface Damageable
- All Superinterfaces:
Audience
,CommandSender
,Entity
,HoverEventSource<HoverEvent.ShowEntity>
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,PersistentDataViewHolder
,Pointered
,ServerOperator
,Sound.Emitter
- All Known Subinterfaces:
AbstractHorse
,AbstractSkeleton
,AbstractVillager
,Ageable
,Allay
,Ambient
,Animals
,Armadillo
,ArmorStand
,Axolotl
,Bat
,Bee
,Blaze
,Bogged
,Breedable
,Breeze
,Camel
,Cat
,CaveSpider
,ChestedHorse
,Chicken
,Cod
,CollarColorable
,ComplexLivingEntity
,Cow
,Creaking
,CreakingTransient
,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
,RangedEntity
,Ravager
,Salmon
,SchoolableFish
,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
Represents an
Entity
that has health and can take damage.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot
-
Method Summary
Modifier and TypeMethodDescriptionvoid
damage
(double amount) Deals the given amount of damage to this entity.void
damage
(double amount, @NotNull DamageSource damageSource) Deals the given amount of damage to this entity from a specifiedDamageSource
.void
Deals the given amount of damage to this entity from a specifiedEntity
.double
Gets the entity's absorption amount.double
Gets the entity's health from 0 togetMaxHealth()
, where 0 is dead.double
Deprecated.default void
heal
(double amount) Heal this entity by the given amount.void
heal
(double amount, EntityRegainHealthEvent.RegainReason reason) Heal this entity by the given amount.void
Deprecated.useAttribute.MAX_HEALTH
.void
setAbsorptionAmount
(double amount) Sets the entity's absorption amount.void
setHealth
(double health) Sets the entity's health from 0 togetMaxHealth()
, where 0 is dead.void
setMaxHealth
(double health) Deprecated.useAttribute.MAX_HEALTH
.Methods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface org.bukkit.command.CommandSender
getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage, sendRichMessage
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, asHoverEvent, broadcastHurtAnimation, collidesAt, copy, copy, createSnapshot, eject, fromMobSpawner, getAsString, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getRider, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, hasNoPhysics, hasRider, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isImmuneToFire, isInBubbleColumn, isInDaylight, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvisible, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isInWorld, isOnGround, isPersistent, isRidable, isRidableInWater, isSilent, isSneaking, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setImmuneToFire, setInvisible, setInvulnerable, setLastDamageCause, setNoPhysics, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setRotation, setSilent, setSneaking, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, teleportAsync, wouldCollideUsing
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
customName, customName, getCustomName, setCustomName
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
damage
void damage(double amount) Deals the given amount of damage to this entity.- Parameters:
amount
- Amount of damage to deal
-
damage
Deals the given amount of damage to this entity from a specifiedEntity
.- Parameters:
amount
- amount of damage to dealsource
- entity to which the damage should be attributed
-
damage
Deals the given amount of damage to this entity from a specifiedDamageSource
.- Parameters:
amount
- amount of damage to dealdamageSource
- source to which the damage should be attributed
-
getHealth
double getHealth()Gets the entity's health from 0 togetMaxHealth()
, where 0 is dead.- Returns:
- Health represented from 0 to max
-
setHealth
void setHealth(double health) Sets the entity's health from 0 togetMaxHealth()
, where 0 is dead.- Parameters:
health
- New health represented from 0 to max- Throws:
IllegalArgumentException
- Thrown if the health is < 0 or >getMaxHealth()
-
heal
default void heal(double amount) Heal this entity by the given amount. This will callEntityRegainHealthEvent
.- Parameters:
amount
- heal amount
-
heal
Heal this entity by the given amount. This will callEntityRegainHealthEvent
.- Parameters:
amount
- heal amountreason
- heal reason
-
getAbsorptionAmount
double getAbsorptionAmount()Gets the entity's absorption amount.- Returns:
- 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.MAX_ABSORPTION
. The effect of this method on that attribute is currently unspecified and subject to change.- Parameters:
amount
- new absorption amount from 0- Throws:
IllegalArgumentException
- thrown if health is < 0 or non-finite.
-
getMaxHealth
Deprecated.useAttribute.MAX_HEALTH
.Gets the maximum health this entity has.- Returns:
- Maximum health
-
setMaxHealth
Deprecated.useAttribute.MAX_HEALTH
.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.- Parameters:
health
- amount of health to set the maximum to
-
resetMaxHealth
Deprecated.useAttribute.MAX_HEALTH
.Resets the max health to the original amount.
-
Attribute.MAX_HEALTH
.