
org.bukkit.entity.LivingEntity Maven / Gradle / Ivy
package org.bukkit.entity;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
import walkmc.annotation.FromWalk;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Represents a living entity, such as a monster or player
*/
public interface LivingEntity extends Entity, Damageable, ProjectileSource {
/**
* Whether an arm swing is currently in progress.
*/
boolean isSwingInProgress();
/**
* Whether an arm swing is currently in progress.
*/
void setSwingInProgress(boolean inProgress);
/**
* Current arm swing progress.
*/
float getSwingProgress();
/**
* Current arm swing progress.
*/
void setSwingProgress(float progress);
/**
* Only relevant when limbYaw is not 0(the entity is moving).
* Influences where in its swing legs and arms currently are.
*/
float getLimbSwing();
/**
* Only relevant when limbYaw is not 0(the entity is moving).
* Influences where in its swing legs and arms currently are.
*/
void setLimbSwing(float limbSwing);
/**
* Gets the NMS entity handler of this entity.
*/
@FromWalk
net.minecraft.server.EntityLiving getHandler();
/**
* Current limb swing amount.
*/
float getLimbSwingAmount();
/**
* Current limb swing amount.
*/
void setLimbSwingAmount(float amount);
/**
* The yaw at which this entity was last attacked from.
*/
float getAttackedAtYaw();
/**
* The yaw at which this entity was last attacked from.
*/
void setAttackedAtYaw(float yaw);
/**
* Amount of ticks since last arrow hit.
*/
int getArrowHitTicks();
/**
* Amount of ticks since last arrow hit.
*/
void setArrowHitTicks(int ticks);
/**
* The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint)
*/
int getHurtTicks();
/**
* The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint)
*/
void setHurtTicks(int ticks);
/**
* What the hurt time was max set to last.
*/
int getMaxHurtTicks();
/**
* What the hurt time was max set to last.
*/
void setMaxHurtTicks(int ticks);
/**
* The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world.
*/
int getDeathTicks();
/**
* The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world.
*/
void setDeathTicks(int ticks);
/**
* Entity camera pitch
*/
float getCameraPitch();
/**
* Entity camera pitch
*/
void setCameraPitch(float pitch);
/**
* Entity render yaw offset
*/
float getRenderYawOffset();
/**
* Entity render yaw offset
*/
void setRenderYawOffset(float offset);
/**
* Entity head rotation yaw
*/
float getRotationYawHead();
/**
* Entity head rotation yaw
*/
void setRotationYawHead(float rotation);
/**
* A factor used to determine how far this entity will move each tick if it is jumping or falling.
*/
float getJumpMovementFactor();
/**
* A factor used to determine how far this entity will move each tick if it is jumping or falling.
*/
void setJumpMovementFactor(float factor);
/**
* Whether the DataWatcher needs to be updated with the active potions
*/
boolean getPotionsNeedUpdate();
/**
* Whether the DataWatcher needs to be updated with the active potions
*/
void setPotionsNeedUpdate(boolean needUpdate);
/**
* The last entity to damage this entity.
*/
LivingEntity getLastDamager();
/**
* The last entity to damage this entity.
*/
void setLastDamager(LivingEntity damager);
/**
* Returns the last entity that this entity attacked.
*/
LivingEntity getLastAttacker();
/**
* Sets the last entity that this entity attacked.
*/
void setLastAttacker(LivingEntity entity);
/**
* Holds the value of ticksExisted when setLastAttacker was last called.
*/
int getLastAttackerTicks();
/**
* Holds the value of ticksExisted when setLastAttacker was last called.
*/
void setLastAttackerTicks(int ticks);
/**
* The hurt timestamp amount in ticks.
*/
int getHurtTimestamp();
/**
* The hurt timestamp amount in ticks.
*/
void setHurtTimestamp(int timestamp);
/**
* Returns the last damage made by player in ticks.
*/
int getLastDamageByPlayerTime();
/**
* Sets the last damage made by player in ticks.
*/
void getLastDamageByPlayerTime(int time);
/**
* Returns the amount of ticks that this entity is far from any player.
*/
int getTicksFarFromPlayer();
/**
* Sets the amount of ticks that this entity is far from any player.
*/
void setTicksFarFromPlayer(int ticks);
/**
* Gets the ground speed factor of this entity.
*/
float getGroundSpeedFactor();
/**
* Sets the ground speed factor of this entity.
*/
void setGroundSpeedFactor(float factor);
/**
* Gets the distance amount that this entity moved.
*/
float getMovedDistance();
/**
* Sets the distance amount that this entity moved.
*/
void setMovedDistance(float distance);
/**
* Returns if this entity is jumping.
*/
boolean isJumping();
/**
* A factor used to determine how far this entity will move each tick if it is walking on land.
* Adjusted by speed, and slipperiness of the current block.
*/
float getLandMovementFactor();
/**
* A factor used to determine how far this entity will move each tick if it is walking on land.
* Adjusted by speed, and slipperiness of the current block.
*/
void setLandMovementFactor(float factor);
/**
* Gets the sprint speed of this entity.
*/
double getSprintSpeed();
/**
* Sets the sprint speed of this entity.
*/
void setSprintSpeed(double speed);
/**
* Gets the knockback resistance of this entity.
*/
double getKnockbackResistance();
/**
* Sets the knockback resistance of this entity.
*/
void setKnockbackResistance(double resistance);
/**
* Gets the damage modifier of this entity.
*/
double getDamageModifier();
/**
* Sets the damage modifier of this entity.
*/
void setDamageModifier(double modifier);
/**
* Number of ticks since last jump
*/
int getJumpTicks();
/**
* Number of ticks since last jump
*/
void setJumpTicks(int ticks);
/**
* Whether if this entity is able to tick any effect.
*/
boolean isTickingEffects();
/**
* Whether if this entity is able to tick any effect.
*/
void setTickingEffects(boolean tickingEffects);
/**
* Gets the height of the living entity's eyes above its Location.
*
* @return height of the living entity's eyes above its location
*/
double getEyeHeight();
/**
* Gets the height of the living entity's eyes above its Location.
*
* @param ignoreSneaking if set to true, the effects of sneaking will be
* ignored
* @return height of the living entity's eyes above its location
*/
double getEyeHeight(boolean ignoreSneaking);
/**
* Get a Location detailing the current eye position of the living entity.
*
* @return a location at the eyes of the living entity
*/
Location getEyeLocation();
/**
* Gets all blocks along the living entity's line of sight.
*
* This list contains all blocks from the living entity's eye position to
* target inclusive.
*
* @param transparent HashSet containing all transparent block IDs (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan (may be limited
* by server by at least 100 blocks, no less)
* @return list containing all blocks along the living entity's line of
* sight
* @deprecated Magic value
*/
@Deprecated
List getLineOfSight(HashSet transparent, int maxDistance);
/**
* Gets all blocks along the living entity's line of sight.
*
* This list contains all blocks from the living entity's eye position to
* target inclusive.
*
* @param transparent HashSet containing all transparent block Materials (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan (may be limited
* by server by at least 100 blocks, no less)
* @return list containing all blocks along the living entity's line of
* sight
*/
List getLineOfSight(Set transparent, int maxDistance);
/**
* Gets the block that the living entity has targeted.
*
* @param transparent HashSet containing all transparent block IDs (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan (may be limited
* by server by at least 100 blocks, no less)
* @return block that the living entity has targeted
* @deprecated Magic value
*/
@Deprecated
Block getTargetBlock(HashSet transparent, int maxDistance);
/**
* Gets the block that the living entity has targeted.
*
* @param transparent HashSet containing all transparent block Materials (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan (may be limited
* by server by at least 100 blocks, no less)
* @return block that the living entity has targeted
*/
Block getTargetBlock(Set transparent, int maxDistance);
/**
* Gets the last two blocks along the living entity's line of sight.
*
* The target block will be the last block in the list.
*
* @param transparent HashSet containing all transparent block IDs (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan. This may be
* further limited by the server, but never to less than 100 blocks
* @return list containing the last 2 blocks along the living entity's
* line of sight
* @deprecated Magic value
*/
@Deprecated
List getLastTwoTargetBlocks(HashSet transparent, int maxDistance);
/**
* Gets the last two blocks along the living entity's line of sight.
*
* The target block will be the last block in the list.
*
* @param transparent HashSet containing all transparent block Materials (set to
* null for only air)
* @param maxDistance this is the maximum distance to scan. This may be
* further limited by the server, but never to less than 100 blocks
* @return list containing the last 2 blocks along the living entity's
* line of sight
*/
List getLastTwoTargetBlocks(Set transparent, int maxDistance);
/**
* Throws an egg from the living entity.
*
* @return the egg thrown
*/
// walkmc - remove deprecated
Egg throwEgg();
/**
* Throws a snowball from the living entity.
*
* @return the snowball thrown
*/
// walkmc - remove deprecated
Snowball throwSnowball();
/**
* Shoots an arrow from the living entity.
*
* @return the arrow shot
*/
// walkmc - remove deprecated
Arrow shootArrow();
/**
* Shoots an enderpearl from the living entity.
*
* @return the enderpearl shot
*/
EnderPearl throwEnderPearl();
/**
* Returns the amount of air that the living entity has remaining, in
* ticks.
*
* @return amount of air remaining
*/
int getRemainingAir();
/**
* Sets the amount of air that the living entity has remaining, in ticks.
*
* @param ticks amount of air remaining
*/
void setRemainingAir(int ticks);
/**
* Returns the maximum amount of air the living entity can have, in ticks.
*
* @return maximum amount of air
*/
int getMaximumAir();
/**
* Sets the maximum amount of air the living entity can have, in ticks.
*
* @param ticks maximum amount of air
*/
void setMaximumAir(int ticks);
/**
* Returns the living entity's current maximum no damage ticks.
*
* This is the maximum duration in which the living entity will not take
* damage.
*
* @return maximum no damage ticks
*/
int getMaximumNoDamageTicks();
/**
* Sets the living entity's current maximum no damage ticks.
*
* @param ticks maximum amount of no damage ticks
*/
void setMaximumNoDamageTicks(int ticks);
/**
* Returns the living entity's last damage taken in the current no damage
* ticks time.
*
* Only damage higher than this amount will further damage the living
* entity.
*
* @return damage taken since the last no damage ticks time period
*/
double getLastDamage();
/**
* Sets the damage dealt within the current no damage ticks time period.
*
* @param damage amount of damage
*/
void setLastDamage(double damage);
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*
* @return damage taken since the last no damage ticks time period
*/
@Deprecated
int _INVALID_getLastDamage();
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*
* @param damage amount of damage
*/
@Deprecated
void _INVALID_setLastDamage(int damage);
/**
* Returns the living entity's current no damage ticks.
*
* @return amount of no damage ticks
*/
int getNoDamageTicks();
/**
* Sets the living entity's current no damage ticks.
*
* @param ticks amount of no damage ticks
*/
void setNoDamageTicks(int ticks);
/**
* Gets the player identified as the killer of the living entity.
*
* May be null.
*
* @return killer player, or null if none found
*/
Player getKiller();
/**
* Adds the given {@link PotionEffect} to the living entity.
*
* Only one potion effect can be present for a given {@link
* PotionEffectType}.
*
* @param effect PotionEffect to be added
* @return whether the effect could be added
*/
boolean addPotionEffect(PotionEffect effect);
/**
* Adds the given {@link PotionEffect} to the living entity.
*
* Only one potion effect can be present for a given {@link
* PotionEffectType}.
*
* @param effect PotionEffect to be added
* @param force whether conflicting effects should be removed
* @return whether the effect could be added
*/
boolean addPotionEffect(PotionEffect effect, boolean force);
/**
* Attempts to add all of the given {@link PotionEffect} to the living
* entity.
*
* @param effects the effects to add
* @return whether all of the effects could be added
*/
boolean addPotionEffects(Collection effects);
/**
* Returns whether the living entity already has an existing effect of
* the given {@link PotionEffectType} applied to it.
*
* @param type the potion type to check
* @return whether the living entity has this potion effect active on them
*/
boolean hasPotionEffect(PotionEffectType type);
/**
* Removes any effects present of the given {@link PotionEffectType}.
*
* @param type the potion type to remove
*/
void removePotionEffect(PotionEffectType type);
/**
* Returns all currently active {@link PotionEffect}s on the living
* entity.
*
* @return a collection of {@link PotionEffect}s
*/
Collection getActivePotionEffects();
/**
* Checks whether the living entity has block line of sight to another.
*
* This uses the same algorithm that hostile mobs use to find the closest
* player.
*
* @param other the entity to determine line of sight to
* @return true if there is a line of sight, false if not
*/
boolean hasLineOfSight(Entity other);
/**
* Returns if the living entity despawns when away from players or not.
*
* By default, animals are not removed while other mobs are.
*
* @return true if the living entity is removed when away from players
*/
boolean getRemoveWhenFarAway();
/**
* Sets whether or not the living entity despawns when away from players
* or not.
*
* @param remove the removal status
*/
void setRemoveWhenFarAway(boolean remove);
/**
* Gets the inventory with the equipment worn by the living entity.
*
* @return the living entity's inventory
*/
EntityEquipment getEquipment();
/**
* Gets if the living entity can pick up items.
*
* @return whether or not the living entity can pick up items
*/
boolean getCanPickupItems();
/**
* Sets whether or not the living entity can pick up items.
*
* @param pickup whether or not the living entity can pick up items
*/
void setCanPickupItems(boolean pickup);
/**
* Returns whether the entity is currently leashed.
*
* @return whether the entity is leashed
*/
boolean isLeashed();
/**
* Gets the entity that is currently leading this entity.
*
* @return the entity holding the leash
* @throws IllegalStateException if not currently leashed
*/
Entity getLeashHolder() throws IllegalStateException;
/**
* Sets the leash on this entity to be held by the supplied entity.
*
* This method has no effect on EnderDragons, Withers, Players, or Bats.
* Non-living entities excluding leashes will not persist as leash
* holders.
*
* @param holder the entity to leash this entity to
* @return whether the operation was successful
*/
boolean setLeashHolder(Entity holder);
}