Class EntityLivingBase

java.lang.Object
net.minecraft.src.Entity
net.minecraft.src.EntityLivingBase
Direct Known Subclasses:
EntityLiving, EntityPlayer

public abstract class EntityLivingBase extends Entity
  • Field Details

    • recentlyOnChoppingBlockCountdown

      protected int recentlyOnChoppingBlockCountdown
    • onChoppingBlockMaxCountdown

      public static final int onChoppingBlockMaxCountdown
      See Also:
    • isLivingDead

      public boolean isLivingDead
      // +++START EDIT+++ Tells if a creature has shed its mortal coil. Entity.isDead is whether an entity is flagged to be removed from the game // ---END EDIT---
    • isSwingInProgress

      public boolean isSwingInProgress
      Whether an arm swing is currently in progress.
    • swingProgressInt

      public int swingProgressInt
    • arrowHitTimer

      public int arrowHitTimer
    • prevHealth

      public float prevHealth
    • hurtTime

      public int hurtTime
      The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint)
    • maxHurtTime

      public int maxHurtTime
      What the hurt time was max set to last.
    • attackedAtYaw

      public float attackedAtYaw
      The yaw at which this entity was last attacked from.
    • deathTime

      public int deathTime
      The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world.
    • attackTime

      public int attackTime
    • prevSwingProgress

      public float prevSwingProgress
    • swingProgress

      public float swingProgress
    • prevLimbSwingAmount

      public float prevLimbSwingAmount
    • limbSwingAmount

      public float limbSwingAmount
    • limbSwing

      public float limbSwing
      Only relevant when limbYaw is not 0(the entity is moving). Influences where in its swing legs and arms currently are.
    • maxHurtResistantTime

      public int maxHurtResistantTime
    • prevCameraPitch

      public float prevCameraPitch
    • cameraPitch

      public float cameraPitch
    • field_70769_ao

      public float field_70769_ao
    • field_70770_ap

      public float field_70770_ap
    • renderYawOffset

      public float renderYawOffset
    • prevRenderYawOffset

      public float prevRenderYawOffset
    • rotationYawHead

      public float rotationYawHead
      Entity head rotation yaw
    • prevRotationYawHead

      public float prevRotationYawHead
      Entity head rotation yaw at previous tick
    • jumpMovementFactor

      public float jumpMovementFactor
      A factor used to determine how far this entity will move each tick if it is jumping or falling.
    • attackingPlayer

      protected EntityPlayer attackingPlayer
      The most recent player that has attacked this entity
    • recentlyHit

      protected int recentlyHit
      Set to 60 when hit by the player or the player's wolf, then decrements. Used to determine whether the entity should drop items on death.
    • dead

      protected boolean dead
      This gets set on entity death, but never used. Looks like a duplicate of isDead
    • entityAge

      protected int entityAge
      Holds the living entity age, used to control the despawn.
    • field_70768_au

      protected float field_70768_au
    • field_110154_aX

      protected float field_110154_aX
    • field_70764_aw

      protected float field_70764_aw
    • field_70763_ax

      protected float field_70763_ax
    • field_70741_aB

      protected float field_70741_aB
    • scoreValue

      protected int scoreValue
      The score value of the Mob, the amount of points the mob is worth.
    • lastDamage

      protected float lastDamage
      Damage taken in the last hit. Mobs are resistant to damage less than this for a short time after taking damage.
    • isJumping

      protected boolean isJumping
      used to check whether entity is jumping.
    • moveStrafing

      public float moveStrafing
    • moveForward

      public float moveForward
    • randomYawVelocity

      protected float randomYawVelocity
    • newPosRotationIncrements

      protected int newPosRotationIncrements
      The number of updates over which the new position and rotation are to be applied to the entity.
    • newPosX

      protected double newPosX
      The new X position to be applied to the entity.
    • newPosY

      protected double newPosY
      The new Y position to be applied to the entity.
    • newPosZ

      protected double newPosZ
    • newRotationYaw

      protected double newRotationYaw
      The new yaw rotation to be applied to the entity.
    • newRotationPitch

      protected double newRotationPitch
      The new yaw rotation to be applied to the entity.
    • entityLivingToAttack

      protected EntityLivingBase entityLivingToAttack
      is only being set, has no uses as of MC 1.1
    • revengeTimer

      protected int revengeTimer
    • revengeCountdown

      protected int revengeCountdown
    • landMovementFactor

      protected float landMovementFactor
      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.
  • Constructor Details

    • EntityLivingBase

      public EntityLivingBase(World par1World)
  • Method Details

    • entityInit

      protected void entityInit()
      Specified by:
      entityInit in class Entity
    • applyEntityAttributes

      protected void applyEntityAttributes()
    • updateFallState

      protected void updateFallState(double par1, boolean par3)
      Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround
      Overrides:
      updateFallState in class Entity
    • canBreatheUnderwater

      public boolean canBreatheUnderwater()
    • onEntityUpdate

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

      public boolean isChild()
      If Animal, checks if the age timer is negative
    • onDeathUpdate

      protected void onDeathUpdate()
      handles entity death timer, experience orb and particle creation
    • decreaseAirSupply

      protected int decreaseAirSupply(int par1)
      Decrements the entity's air supply when underwater
    • getExperiencePoints

      protected int getExperiencePoints(EntityPlayer par1EntityPlayer)
      Get the experience points the entity currently has.
    • isPlayer

      protected boolean isPlayer()
      Only use is to identify if class is an instance of player for experience dropping
    • getRNG

      public Random getRNG()
    • getAITarget

      public EntityLivingBase getAITarget()
    • func_142015_aE

      public int func_142015_aE()
    • setRevengeTarget

      public void setRevengeTarget(EntityLivingBase par1EntityLivingBase)
    • getLastAttacker

      public EntityLivingBase getLastAttacker()
    • getLastAttackerTime

      public int getLastAttackerTime()
    • setLastAttacker

      public void setLastAttacker(Entity par1Entity)
    • getAge

      public int getAge()
    • writeEntityToNBT

      public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
      (abstract) Protected helper method to write subclass entity data to NBT.
      Specified by:
      writeEntityToNBT in class Entity
    • readEntityFromNBT

      public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      Specified by:
      readEntityFromNBT in class Entity
    • updatePotionEffects

      protected void updatePotionEffects()
    • clearActivePotions

      public void clearActivePotions()
    • getActivePotionEffects

      public Collection getActivePotionEffects()
    • isPotionActive

      public boolean isPotionActive(int par1)
    • isPotionActive

      public boolean isPotionActive(Potion par1Potion)
    • getActivePotionEffect

      public PotionEffect getActivePotionEffect(Potion par1Potion)
      returns the PotionEffect for the supplied Potion if it is active, null otherwise.
    • addPotionEffect

      public void addPotionEffect(PotionEffect par1PotionEffect)
      adds a PotionEffect to the entity
    • isPotionApplicable

      public boolean isPotionApplicable(PotionEffect par1PotionEffect)
    • isEntityUndead

      public boolean isEntityUndead()
      Returns true if this entity is undead.
    • removePotionEffectClient

      public void removePotionEffectClient(int par1)
      Remove the speified potion effect from this entity.
    • removePotionEffect

      public void removePotionEffect(int par1)
      Remove the specified potion effect from this entity.
    • onNewPotionEffect

      protected void onNewPotionEffect(PotionEffect par1PotionEffect)
    • onChangedPotionEffect

      protected void onChangedPotionEffect(PotionEffect par1PotionEffect, boolean par2)
    • onFinishedPotionEffect

      protected void onFinishedPotionEffect(PotionEffect par1PotionEffect)
    • heal

      public void heal(float par1)
      Heal living entity (param: amount of half-hearts)
    • getHealth

      public final float getHealth()
    • setHealth

      public void setHealth(float par1)
    • attackEntityFrom

      public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
      Called when the entity is attacked.
      Overrides:
      attackEntityFrom in class Entity
    • renderBrokenItemStack

      public void renderBrokenItemStack(ItemStack par1ItemStack)
      Renders broken item particles using the given ItemStack
    • onDeath

      public void onDeath(DamageSource source)
      Called when the mob's health reaches 0.
    • entityLivingOnDeath

      public void entityLivingOnDeath(DamageSource source)
    • checkForRareDrop

      protected void checkForRareDrop(DamageSource source, int iLootingModifier)
    • checkForScrollDrop

      public void checkForScrollDrop()
    • checkForHeadDrop

      protected void checkForHeadDrop(DamageSource source, int iLootingModifier)
    • getAmbientLootingModifier

      protected int getAmbientLootingModifier()
    • dropHead

      protected void dropHead()
    • dropEquipment

      protected void dropEquipment(boolean par1, int par2)
      Drop the equipment for this entity.
    • knockBack

      public void knockBack(Entity par1Entity, float par2, double par3, double par5)
      knocks back this entity
    • getHurtSound

      protected String getHurtSound()
      Returns the sound this mob makes when it is hurt.
    • getDeathSound

      protected String getDeathSound()
      Returns the sound this mob makes on death.
    • dropRareDrop

      protected void dropRareDrop(int par1)
    • 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.
    • isOnLadder

      public boolean isOnLadder()
      returns true if this entity is by a ladder, false otherwise
    • isEntityAlive

      public boolean isEntityAlive()
      Checks whether target entity is alive.
      Overrides:
      isEntityAlive in class Entity
    • fall

      protected void fall(float par1)
      Called when the mob is falling. Calculates and applies fall damage.
      Overrides:
      fall in class Entity
    • entityLivingBaseFall

      protected void entityLivingBaseFall(float par1)
    • performHurtAnimation

      public void performHurtAnimation()
      Setups the entity to do the hurt animation. Only used by packets in multiplayer.
      Overrides:
      performHurtAnimation in class Entity
    • getTotalArmorValue

      public int getTotalArmorValue()
      Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
    • damageArmor

      protected void damageArmor(float par1)
    • applyArmorCalculations

      protected float applyArmorCalculations(DamageSource damageSource, float damageAmount)
      Reduces damage, depending on armor
    • applyPotionDamageCalculations

      protected float applyPotionDamageCalculations(DamageSource par1DamageSource, float par2)
      Reduces damage, depending on potions
    • damageEntity

      protected void damageEntity(DamageSource par1DamageSource, float par2)
      Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health second with the reduced value. Args: damageAmount
    • func_110142_aN

      public CombatTracker func_110142_aN()
    • func_94060_bK

      public EntityLivingBase func_94060_bK()
    • getMaxHealth

      public final float getMaxHealth()
    • getArrowCountInEntity

      public final int getArrowCountInEntity()
      counts the amount of arrows stuck in the entity. getting hit by arrows increases this, used in rendering
    • setArrowCountInEntity

      public final void setArrowCountInEntity(int par1)
      sets the amount of arrows stuck in the entity. used for rendering those
    • swingItem

      public void swingItem()
      Swings the item the player is holding.
    • handleHealthUpdate

      public void handleHealthUpdate(byte par1)
      Overrides:
      handleHealthUpdate in class Entity
    • kill

      protected void kill()
      sets the dead flag. Used when you fall off the bottom of the world.
      Overrides:
      kill in class Entity
    • updateArmSwingProgress

      protected void updateArmSwingProgress()
      Updates the arm swing progress counters and animation progress
    • getEntityAttribute

      public AttributeInstance getEntityAttribute(Attribute par1Attribute)
    • getAttributeMap

      public BaseAttributeMap getAttributeMap()
    • getCreatureAttribute

      public EnumCreatureAttribute getCreatureAttribute()
      Get this Entity's EnumCreatureAttribute
    • getHeldItem

      public abstract ItemStack getHeldItem()
      Returns the item that this EntityLiving is holding, if any.
    • getCurrentItemOrArmor

      public abstract ItemStack getCurrentItemOrArmor(int var1)
      0 = item, 1-n is armor
    • setCurrentItemOrArmor

      public abstract void setCurrentItemOrArmor(int var1, ItemStack var2)
      Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot
      Overrides:
      setCurrentItemOrArmor in class Entity
    • setSprinting

      public void setSprinting(boolean par1)
      Set sprinting switch for Entity.
      Overrides:
      setSprinting in class Entity
    • getSpeedModifier

      public float getSpeedModifier()
    • getLastActiveItems

      public abstract ItemStack[] getLastActiveItems()
      Overrides:
      getLastActiveItems in class Entity
    • getSoundVolume

      protected float getSoundVolume()
      Returns the volume for the sounds this mob makes.
    • getSoundPitch

      protected float getSoundPitch()
      Gets the pitch of living sounds in living entities.
    • isMovementBlocked

      protected boolean isMovementBlocked()
      Dead and sleeping entities cannot move
    • setPositionAndUpdate

      public void setPositionAndUpdate(double par1, double par3, double par5)
      Move the entity to the coordinates informed, but keep yaw/pitch values.
    • dismountEntity

      public void dismountEntity(Entity par1Entity)
      Moves the entity to a position out of the way of its mount.
    • getAlwaysRenderNameTagForRender

      public boolean getAlwaysRenderNameTagForRender()
    • getItemIcon

      public Icon getItemIcon(ItemStack par1ItemStack, int par2)
      Gets the Icon Index of the item currently held
    • jump

      public void jump()
      Causes this entity to do an upwards motion (jumping).
    • moveEntityWithHeading

      public void moveEntityWithHeading(float par1, float par2)
      Moves the entity based on the specified heading. Args: strafe, forward
    • isAIEnabled

      protected boolean isAIEnabled()
      Returns true if the newer Entity AI code should be run
    • getAIMoveSpeed

      public float getAIMoveSpeed()
      the movespeed used for the new AI system
    • setAIMoveSpeed

      public void setAIMoveSpeed(float par1)
      set the movespeed used for the new AI system
    • attackEntityAsMob

      public boolean attackEntityAsMob(Entity par1Entity)
    • isPlayerSleeping

      public boolean isPlayerSleeping()
      Returns whether player is sleeping or not
    • onUpdate

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

      protected float func_110146_f(float par1, float par2)
    • 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.
    • updateAITasks

      protected void updateAITasks()
    • collideWithNearbyEntities

      protected void collideWithNearbyEntities()
    • collideWithEntity

      protected void collideWithEntity(Entity par1Entity)
    • updateRidden

      public void updateRidden()
      Handles updating while being ridden by an entity
      Overrides:
      updateRidden in class Entity
    • setPositionAndRotation2

      public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
      Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, posY, posZ, yaw, pitch
      Overrides:
      setPositionAndRotation2 in class Entity
    • updateAITick

      protected void updateAITick()
      main AI tick function, replaces updateEntityActionState
    • updateEntityActionState

      protected void updateEntityActionState()
    • setJumping

      public void setJumping(boolean par1)
    • onItemPickup

      public void onItemPickup(Entity par1Entity, int par2)
      Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize
    • canEntityBeSeen

      public boolean canEntityBeSeen(Entity par1Entity)
      returns true if the entity provided in the argument can be seen. (Raytrace)
    • getLookVec

      public Vec3 getLookVec()
      returns a (normalized) vector of where this entity is looking
      Overrides:
      getLookVec in class Entity
    • getLook

      public Vec3 getLook(float par1)
      interpolated look vector
    • getSwingProgress

      public float getSwingProgress(float par1)
      Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime
    • getPosition

      public Vec3 getPosition(float par1)
      interpolated position vector
    • rayTrace

      public MovingObjectPosition rayTrace(double par1, float par3)
      Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime
    • isClientWorld

      public boolean isClientWorld()
      Returns whether the entity is in a local (client) world
    • canBeCollidedWith

      public boolean canBeCollidedWith()
      Returns true if other Entities should be prevented from moving through this Entity.
      Overrides:
      canBeCollidedWith in class Entity
    • canBePushed

      public boolean canBePushed()
      Returns true if this entity should push and be pushed by other entities when colliding.
      Overrides:
      canBePushed in class Entity
    • getEyeHeight

      public float getEyeHeight()
      Overrides:
      getEyeHeight in class Entity
    • setBeenAttacked

      public void setBeenAttacked()
      Sets that this entity has been attacked.
      Overrides:
      setBeenAttacked in class Entity
    • getRotationYawHead

      public float getRotationYawHead()
      Overrides:
      getRotationYawHead in class Entity
    • setRotationYawHead

      public void setRotationYawHead(float par1)
      Sets the head's yaw rotation of the entity.
      Overrides:
      setRotationYawHead in class Entity
    • getAbsorptionAmount

      public float getAbsorptionAmount()
    • setAbsorptionAmount

      public void setAbsorptionAmount(float par1)
    • getTeam

      public Team getTeam()
    • isOnSameTeam

      public boolean isOnSameTeam(EntityLivingBase par1EntityLivingBase)
    • isOnTeam

      public boolean isOnTeam(Team par1Team)
      Returns true if the entity is on a specific team.
    • getHealthAndExhaustionModifier

      protected float getHealthAndExhaustionModifier()
    • getSwimmingHorizontalModifier

      protected float getSwimmingHorizontalModifier()
    • getLandMovementModifier

      protected float getLandMovementModifier()
    • getLadderVerticalMovementModifier

      protected float getLadderVerticalMovementModifier()
    • knockbackMagnitude

      public float knockbackMagnitude()
    • getDefaultSlipperinessOnGround

      public float getDefaultSlipperinessOnGround()
    • getSlipperinessRelativeToBlock

      public float getSlipperinessRelativeToBlock(int iBlockID)
    • canJump

      public boolean canJump()
    • canSwim

      public boolean canSwim()
    • isWeighted

      public boolean isWeighted()
    • isWeightedByHeadCrab

      protected boolean isWeightedByHeadCrab()
    • recoverAirSupply

      protected void recoverAirSupply()
    • canJumpMidWater

      public boolean canJumpMidWater()
    • getMeleeAttackStrength

      @Deprecated public int getMeleeAttackStrength(Entity target)
      Deprecated.
    • mouseOverCustomRayTrace

      @Environment(CLIENT) public MovingObjectPosition mouseOverCustomRayTrace(double dDistance, float fInterpolationFactor)