Class EntityLiving

Direct Known Subclasses:
EntityAmbientCreature, EntityCreature, EntityDragon, EntityFlying, EntitySlime

public abstract class EntityLiving extends EntityLivingBase
  • Field Details

    • livingSoundTime

      public int livingSoundTime
      Number of ticks since this mouseOverCustomRayTraceEntityLiving last produced its sound
    • HAS_ATTACK_TARGET_DATA_WATCHER_ID

      protected static final int HAS_ATTACK_TARGET_DATA_WATCHER_ID
      See Also:
    • experienceValue

      protected int experienceValue
      The experience points the Entity gives.
    • tasks

      protected final EntityAITasks tasks
    • targetTasks

      protected final EntityAITasks targetTasks
    • equipmentDropChances

      protected float[] equipmentDropChances
      Chances for each equipment piece from dropping when this entity dies.
    • defaultPitch

      protected float defaultPitch
    • numTicksToChaseTarget

      protected int numTicksToChaseTarget
      How long to keep a specific target entity
  • Constructor Details

    • EntityLiving

      public EntityLiving(World par1World)
  • Method Details

    • applyEntityAttributes

      protected void applyEntityAttributes()
      Overrides:
      applyEntityAttributes in class EntityLivingBase
    • func_110146_f

      protected float func_110146_f(float par1, float par2)
      Overrides:
      func_110146_f in class EntityLivingBase
    • dropFewItems

      protected void dropFewItems(boolean par1, int par2)
      Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param par2 - Level of Looting used to kill this mob.
      Overrides:
      dropFewItems in class EntityLivingBase
    • setAIMoveSpeed

      public void setAIMoveSpeed(float par1)
      set the movespeed used for the new AI system
      Overrides:
      setAIMoveSpeed in class EntityLivingBase
    • getLookHelper

      public EntityLookHelper getLookHelper()
    • getMoveHelper

      public EntityMoveHelper getMoveHelper()
    • getJumpHelper

      public EntityJumpHelper getJumpHelper()
    • getNavigator

      public PathNavigate getNavigator()
    • getEntitySenses

      public EntitySenses getEntitySenses()
      returns the EntitySenses Object for the EntityLiving
    • enchantEquipment

      protected void enchantEquipment()
      Enchants the entity's armor and held item based on difficulty
    • onSpawnWithEgg

      public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData)
    • entityLivingOnSpawnWithEgg

      public EntityLivingData entityLivingOnSpawnWithEgg(EntityLivingData par1EntityLivingData)
    • getAttackTarget

      public EntityLivingBase getAttackTarget()
      Gets the active target the Task system uses for tracking
    • hasAttackTarget

      public boolean hasAttackTarget()
      Uses dataWatcher to tell if this entity has a target.
    • func_110163_bv

      public void func_110163_bv()
    • attackEntityAsMob

      public boolean attackEntityAsMob(Entity par1Entity)
      Overrides:
      attackEntityAsMob in class EntityLivingBase
    • meleeAttack

      public boolean meleeAttack(Entity target)
    • setAttackTarget

      public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
      Sets the active target the Task system uses for tracking
    • entityLivingSetAttackTarget

      protected void entityLivingSetAttackTarget(EntityLivingBase par1EntityLiving)
    • canAttackClass

      public boolean canAttackClass(Class par1Class)
      Returns true if this entity can attack entities of the specified class.
    • eatGrassBonus

      public void eatGrassBonus()
      This function applies the benefits of growing back wool and faster growing up to the acting entity. (This function is used in the AIEatGrass)
    • interactFirst

      public final boolean interactFirst(EntityPlayer par1EntityPlayer)
      First layer of player interaction
      Overrides:
      interactFirst in class Entity
    • entityInit

      protected void entityInit()
      Overrides:
      entityInit in class EntityLivingBase
    • interact

      protected boolean interact(EntityPlayer par1EntityPlayer)
      Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
    • func_110159_bB

      protected void func_110159_bB()
    • clearLeashed

      public void clearLeashed(boolean par1, boolean par2)
      Removes the leash from this entity. Second parameter tells whether to send a packet to surrounding players.
    • allowLeashing

      public boolean allowLeashing()
    • getLeashed

      public boolean getLeashed()
    • getLeashedToEntity

      public Entity getLeashedToEntity()
    • setLeashedToEntity

      public void setLeashedToEntity(Entity par1Entity, boolean par2)
      Sets the entity to be leashed to.\nArgs:\n@param par1Entity: The entity to be tethered to.\n@param par2: Whether to send an attaching notification packet to surrounding players.
    • getTalkInterval

      public int getTalkInterval()
      Get number of ticks, at least during which the living entity will be silent.
    • playLivingSound

      public void playLivingSound()
      Plays living's sound at its position
    • onEntityUpdate

      public void onEntityUpdate()
      Gets called every tick from main Entity class
      Overrides:
      onEntityUpdate in class EntityLivingBase
    • getExperiencePoints

      protected int getExperiencePoints(EntityPlayer par1EntityPlayer)
      Get the experience points the entity currently has.
      Overrides:
      getExperiencePoints in class EntityLivingBase
    • spawnExplosionParticle

      public void spawnExplosionParticle()
      Spawns an explosion particle around the Entity's location
    • onUpdate

      public void onUpdate()
      Called to update the entity's position/logic.
      Overrides:
      onUpdate in class EntityLivingBase
    • getLivingSound

      protected String getLivingSound()
      Returns the sound this mob makes while it's alive.
    • entityLivingDropFewItems

      protected void entityLivingDropFewItems(boolean par1, int par2)
    • getDropItemId

      protected int getDropItemId()
      Returns the item ID for the item the mob drops on death.
    • writeEntityToNBT

      public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
      // +++START EDIT+++ // ---END EDIT--- (abstract) Protected helper method to write subclass entity data to NBT.
      Overrides:
      writeEntityToNBT in class EntityLivingBase
    • readEntityFromNBT

      public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      Overrides:
      readEntityFromNBT in class EntityLivingBase
    • setMoveForward

      public void setMoveForward(float par1)
    • onLivingUpdate

      public void onLivingUpdate()
      Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons use this to react to sunlight and start to burn.
      Overrides:
      onLivingUpdate in class EntityLivingBase
    • entityLivingOnLivingUpdate

      protected void entityLivingOnLivingUpdate()
    • isAIEnabled

      protected boolean isAIEnabled()
      Returns true if the newer Entity AI code should be run
      Overrides:
      isAIEnabled in class EntityLivingBase
    • canDespawn

      protected boolean canDespawn()
      Determines if an entity can be despawned, used on idle far away entities
    • updateAITasks

      protected void updateAITasks()
      Overrides:
      updateAITasks in class EntityLivingBase
    • entityLivingUpdateAITasks

      protected void entityLivingUpdateAITasks()
    • updateEntityActionState

      protected void updateEntityActionState()
      Overrides:
      updateEntityActionState in class EntityLivingBase
    • getVerticalFaceSpeed

      public int getVerticalFaceSpeed()
      The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently use in wolves.
    • faceEntity

      public void faceEntity(Entity par1Entity, float par2, float par3)
      Changes pitch and yaw so that the entity calling the function is facing the entity provided as an argument.
    • isNoDespawnRequired

      public boolean isNoDespawnRequired()
    • getCanSpawnHere

      public boolean getCanSpawnHere()
      Checks if the entity's current position is a valid location to spawn this entity.
    • getRenderSizeModifier

      public float getRenderSizeModifier()
      Returns render size modifier
    • getMaxSpawnedInChunk

      public int getMaxSpawnedInChunk()
      Will return how many at most can spawn in a chunk at once.
    • getMaxSafePointTries

      public int getMaxSafePointTries()
      The number of iterations PathFinder.getSafePoint will execute before giving up.
      Overrides:
      getMaxSafePointTries in class Entity
    • getHeldItem

      public ItemStack getHeldItem()
      Returns the item that this EntityLiving is holding, if any.
      Specified by:
      getHeldItem in class EntityLivingBase
    • getCurrentItemOrArmor

      public ItemStack getCurrentItemOrArmor(int par1)
      0 = item, 1-n is armor
      Specified by:
      getCurrentItemOrArmor in class EntityLivingBase
    • func_130225_q

      public ItemStack func_130225_q(int par1)
    • getCurrentArmorBTW

      public ItemStack getCurrentArmorBTW(int par1)
    • setCurrentItemOrArmor

      public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack)
      Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot
      Specified by:
      setCurrentItemOrArmor in class EntityLivingBase
    • getLastActiveItems

      public ItemStack[] getLastActiveItems()
      Specified by:
      getLastActiveItems in class EntityLivingBase
    • dropEquipment

      protected void dropEquipment(boolean par1, int par2)
      Drop the equipment for this entity.
      Overrides:
      dropEquipment in class EntityLivingBase
    • addRandomArmor

      protected void addRandomArmor()
      Makes entity wear random armor based on difficulty
    • entityLivingAddRandomArmor

      protected void entityLivingAddRandomArmor()
    • getArmorPosition

      public static int getArmorPosition(ItemStack par0ItemStack)
    • canBeSteered

      public boolean canBeSteered()
      returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden by a player and the player is holding a carrot-on-a-stick
    • getEntityName

      public String getEntityName()
      Gets the username of the entity.
      Overrides:
      getEntityName in class Entity
    • setCustomNameTag

      public void setCustomNameTag(String par1Str)
    • getCustomNameTag

      public String getCustomNameTag()
    • hasCustomNameTag

      public boolean hasCustomNameTag()
    • setAlwaysRenderNameTag

      public void setAlwaysRenderNameTag(boolean par1)
    • getAlwaysRenderNameTag

      public boolean getAlwaysRenderNameTag()
    • getAlwaysRenderNameTagForRender

      public boolean getAlwaysRenderNameTagForRender()
      Overrides:
      getAlwaysRenderNameTagForRender in class EntityLivingBase
    • setEquipmentDropChance

      public void setEquipmentDropChance(int par1, float par2)
    • canPickUpLoot

      public boolean canPickUpLoot()
    • setCanPickUpLoot

      public void setCanPickUpLoot(boolean par1)
    • modSpecificOnLivingUpdate

      protected void modSpecificOnLivingUpdate()
    • getArmorItemForSlot

      public Item getArmorItemForSlot(int par0, int par1)
    • onFlungBySquidTentacle

      public void onFlungBySquidTentacle(BTWSquidEntity squid)
      Overrides:
      onFlungBySquidTentacle in class Entity
    • onHeadCrabbedBySquid

      public void onHeadCrabbedBySquid(BTWSquidEntity squid)
      Overrides:
      onHeadCrabbedBySquid in class Entity
    • spawnerInitCreature

      public void spawnerInitCreature()
    • preInitCreature

      public void preInitCreature()
      Initialize state variables which may affect ability to spawn, such as bounding box size
    • canEntityCenterOfMassBeSeen

      public boolean canEntityCenterOfMassBeSeen(Entity entity)
    • setPersistent

      public void setPersistent(boolean bPersistant)
    • doesEntityApplyToSpawnCap

      public boolean doesEntityApplyToSpawnCap()
      Overrides:
      doesEntityApplyToSpawnCap in class Entity
    • outOfUpdateRangeUpdate

      public void outOfUpdateRangeUpdate()
      Overrides:
      outOfUpdateRangeUpdate in class Entity
    • onClimbWhileSwimming

      public void onClimbWhileSwimming()
    • despawnEntity

      protected void despawnEntity()
    • minDistFromPlayerForDespawn

      protected double minDistFromPlayerForDespawn()
    • isInsideSpawnAreaAroundPlayer

      protected boolean isInsideSpawnAreaAroundPlayer(EntityPlayer player)
    • isInsideSpawnAreaAroundOriginalSpawn

      protected boolean isInsideSpawnAreaAroundOriginalSpawn()
    • isInsideSpawnAreaAroundChunk

      protected boolean isInsideSpawnAreaAroundChunk(int iChunkX, int iChunkZ)
    • attractsLightning

      public boolean attractsLightning()
      Overrides:
      attractsLightning in class Entity
    • installationIntegrityTest

      public static boolean installationIntegrityTest()