Interface IEntityLivingBase<T extends net.minecraft.entity.EntityLivingBase>

  • Type Parameters:
    T - the underlying Minecraft EntityLivingBase type.
    All Superinterfaces:
    IEntity<T>
    All Known Subinterfaces:
    IAnimal<T>, ICustomNpc<T>, IDBCPlayer, IEntityLiving<T>, IMonster<T>, IPixelmon<T>, IPlayer<T>, IVillager<T>

    public interface IEntityLivingBase<T extends net.minecraft.entity.EntityLivingBase>
    extends IEntity<T>
    Represents a living entity (mob, NPC, etc.) with additional methods to manage health, damage, targeting, vision, potion effects, equipment, and various attributes.

    This interface extends IEntity and provides functionality specific to living entities.

    • Method Detail

      • getHealth

        float getHealth()
        Returns the entity's current health.
        Returns:
        the health value.
      • setHealth

        void setHealth​(float health)
        Sets the entity's health to the specified value.
        Parameters:
        health - the new health value.
      • hurt

        void hurt​(float damage)
        Applies damage to this entity using a generic damage source.
        Parameters:
        damage - the damage amount.
      • hurt

        void hurt​(float damage,
                  IEntity source)
        Applies damage to this entity with the given source entity.
        Parameters:
        damage - the damage amount.
        source - the source entity.
      • hurt

        void hurt​(float damage,
                  IDamageSource damageSource)
        Applies damage to this entity using a custom damage source.
        Parameters:
        damage - the damage amount.
        damageSource - the damage source.
      • setMaxHurtTime

        void setMaxHurtTime​(int time)
        Sets the maximum hurt time (hurt resistance time) for this entity.
        Parameters:
        time - the time in ticks.
      • getMaxHurtTime

        int getMaxHurtTime()
        Returns the maximum hurt time (hurt resistance time) for this entity.
        Returns:
        the time in ticks.
      • getMaxHealth

        double getMaxHealth()
        Returns the entity's maximum health.
        Returns:
        the maximum health.
      • getFollowRange

        double getFollowRange()
        Returns the follow range attribute of the entity.
        Returns:
        the follow range.
      • getKnockbackResistance

        double getKnockbackResistance()
        Returns the knockback resistance of the entity.
        Returns:
        the knockback resistance.
      • getSpeed

        double getSpeed()
        Returns the movement speed of the entity.
        Returns:
        the speed.
      • getMeleeStrength

        double getMeleeStrength()
        Returns the melee strength (attack damage) of the entity.
        Returns:
        the melee strength.
      • setMaxHealth

        void setMaxHealth​(double health)
        Sets the entity's maximum health.
        Parameters:
        health - the new maximum health.
      • setFollowRange

        void setFollowRange​(double range)
        Sets the follow range of the entity.
        Parameters:
        range - the new follow range.
      • setKnockbackResistance

        void setKnockbackResistance​(double knockbackResistance)
        Sets the knockback resistance of the entity.
        Parameters:
        knockbackResistance - the new knockback resistance.
      • setSpeed

        void setSpeed​(double speed)
        Sets the movement speed of the entity.
        Parameters:
        speed - the new movement speed.
      • setMeleeStrength

        void setMeleeStrength​(double attackDamage)
        Sets the melee strength (attack damage) of the entity.
        Parameters:
        attackDamage - the new attack damage.
      • isAttacking

        boolean isAttacking()
        Returns:
        true if this entity is currently attacking a target; false otherwise.
      • setAttackTarget

        void setAttackTarget​(IEntityLivingBase living)
        Sets the attack target for this entity.
        Parameters:
        living - the target entity.
      • getAttackTarget

        IEntityLivingBase getAttackTarget()
        Returns the current attack target.
        Returns:
        the target entity.
      • getAttackTargetTime

        int getAttackTargetTime()
        Returns the time (in ticks) for which the current attack target has been active.
        Returns:
        the attack target time.
      • setLastAttacker

        void setLastAttacker​(IEntity p_130011_1_)
        Sets the last attacker for this entity.
        Parameters:
        p_130011_1_ - the last attacker.
      • getLastAttacker

        IEntity getLastAttacker()
        Returns the last attacker of this entity.
        Returns:
        the last attacker.
      • getLastAttackerTime

        int getLastAttackerTime()
        Returns the time (in ticks) since the entity was last attacked.
        Returns:
        the last attacker time.
      • canBreatheUnderwater

        boolean canBreatheUnderwater()
        Checks whether the entity can breathe underwater.
        Returns:
        true if it can breathe underwater; false otherwise.
      • getType

        int getType()
        Returns the EntityType (as defined in scripting constants) for this entity.
        Specified by:
        getType in interface IEntity<T extends net.minecraft.entity.EntityLivingBase>
        Returns:
        the entity type.
      • typeOf

        boolean typeOf​(int type)
        Checks if this entity is of the specified type.
        Specified by:
        typeOf in interface IEntity<T extends net.minecraft.entity.EntityLivingBase>
        Parameters:
        type - the type to check.
        Returns:
        true if this entity is of that type; false otherwise.
      • getLookVector

        IPos getLookVector()
        Returns the look vector of this entity as an IPos object.
        Returns:
        the look vector.
      • getLookingAtBlock

        IBlock getLookingAtBlock​(int maxDistance,
                                 boolean stopOnBlock,
                                 boolean stopOnLiquid,
                                 boolean stopOnCollision)
        Returns the block that the entity is looking at, with detailed stopping conditions.
        Parameters:
        maxDistance - the maximum distance to check.
        stopOnBlock - whether to stop on any block.
        stopOnLiquid - whether to stop on liquids.
        stopOnCollision - whether to stop on collisions.
        Returns:
        the block being looked at.
      • getLookingAtBlock

        IBlock getLookingAtBlock​(int maxDistance)
        Returns the first block found by following the entity's look vector, using default parameters (stop on block).
        Parameters:
        maxDistance - the maximum distance to check.
        Returns:
        the block being looked at.
      • getLookingAtPos

        IPos getLookingAtPos​(int maxDistance,
                             boolean stopOnBlock,
                             boolean stopOnLiquid,
                             boolean stopOnCollision)
        Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector, with detailed stopping conditions.
        Parameters:
        maxDistance - the maximum distance to check.
        stopOnBlock - whether to stop on blocks.
        stopOnLiquid - whether to stop on liquids.
        stopOnCollision - whether to stop on collisions.
        Returns:
        the obstructed position, or the final position if unobstructed.
      • getLookingAtPos

        IPos getLookingAtPos​(int maxDistance)
        Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector, using default parameters (stop on block).
        Parameters:
        maxDistance - the maximum distance to check.
        Returns:
        the position being looked at.
      • getLookingAtEntities

        IEntity[] getLookingAtEntities​(IEntity[] ignoreEntities,
                                       int maxDistance,
                                       double offset,
                                       double range,
                                       boolean stopOnBlock,
                                       boolean stopOnLiquid,
                                       boolean stopOnCollision)
        Returns an array of entities intersecting with the entity's look vector. Entities are sorted first by proximity along the vector, then by closeness to the vector.
        Parameters:
        ignoreEntities - an array of entities to ignore.
        maxDistance - the maximum distance to check.
        offset - the offset along the vector.
        range - the search radius around the vector.
        stopOnBlock - whether to stop on blocks.
        stopOnLiquid - whether to stop on liquids.
        stopOnCollision - whether to stop on collisions.
        Returns:
        an array of entities.
      • getLookingAtEntities

        IEntity[] getLookingAtEntities​(int maxDistance,
                                       double offset,
                                       double range,
                                       boolean stopOnBlock,
                                       boolean stopOnLiquid,
                                       boolean stopOnCollision)
        Returns an array of entities intersecting with the entity's look vector with detailed stop conditions.
        Parameters:
        maxDistance - the maximum distance.
        offset - the offset.
        range - the search radius.
        stopOnBlock - whether to stop on blocks.
        stopOnLiquid - whether to stop on liquids.
        stopOnCollision - whether to stop on collisions.
        Returns:
        an array of entities.
      • getLookingAtEntities

        IEntity[] getLookingAtEntities​(int maxDistance,
                                       double offset,
                                       double range)
        Returns an array of entities intersecting with the entity's look vector using default stop conditions.
        Parameters:
        maxDistance - the maximum distance.
        offset - the offset.
        range - the search radius.
        Returns:
        an array of entities.
      • getMCEntity

        T getMCEntity()
        Expert use only. Returns the underlying Minecraft EntityLivingBase object.
        Specified by:
        getMCEntity in interface IEntity<T extends net.minecraft.entity.EntityLivingBase>
        Returns:
        the Minecraft entity.
      • swingHand

        void swingHand()
        Makes the entity swing its hand.
      • addPotionEffect

        void addPotionEffect​(int effect,
                             int duration,
                             int strength,
                             boolean hideParticles)
        Applies a potion effect to the entity. Works similarly to the /effect command.
        Parameters:
        effect - the potion effect ID.
        duration - the duration in seconds.
        strength - the amplifier of the effect.
        hideParticles - whether to hide potion particles.
      • clearPotionEffects

        void clearPotionEffects()
        Clears all active potion effects from the entity.
      • getPotionEffect

        int getPotionEffect​(int effect)
        Returns the amplifier of the specified potion effect. If the effect is not active, returns -1.
        Parameters:
        effect - the potion effect ID.
        Returns:
        the amplifier, or -1 if not active.
      • getHeldItem

        IItemStack getHeldItem()
        Returns the item the entity is currently holding. Note that not all living entities support this.
        Returns:
        the held item.
      • setHeldItem

        void setHeldItem​(IItemStack item)
        Sets the item the entity is holding. Note that not all living entities support this.
        Parameters:
        item - the item to set.
      • getArmor

        IItemStack getArmor​(int slot)
        Returns the armor piece in the given slot. Slots: 0 - boots, 1 - pants, 2 - body, 3 - head.
        Parameters:
        slot - the armor slot.
        Returns:
        the armor item.
      • setArmor

        void setArmor​(int slot,
                      IItemStack item)
        Sets the armor piece in the given slot. Slots: 0 - boots, 1 - pants, 2 - body, 3 - head.
        Parameters:
        slot - the armor slot.
        item - the item to set.
      • isChild

        boolean isChild()
        Returns:
        true if this entity is a child.
      • renderBrokenItemStack

        void renderBrokenItemStack​(IItemStack itemStack)
        Renders a broken item stack effect for the given item.
        Parameters:
        itemStack - the item stack.
      • isOnLadder

        boolean isOnLadder()
        Returns:
        true if the entity is on a ladder.
      • getTotalArmorValue

        int getTotalArmorValue()
        Returns the total armor value of the entity.
        Returns:
        the armor value.
      • getArrowCountInEntity

        int getArrowCountInEntity()
        Returns the number of arrows currently embedded in the entity.
        Returns:
        the arrow count.
      • setArrowCountInEntity

        void setArrowCountInEntity​(int count)
        Sets the number of arrows embedded in the entity.
        Parameters:
        count - the new arrow count.
      • dismountEntity

        void dismountEntity​(IEntity entity)
        Dismounts the specified entity from this entity.
        Parameters:
        entity - the entity to dismount.
      • setAIMoveSpeed

        void setAIMoveSpeed​(float speed)
        Sets the AI move speed for the entity.
        Parameters:
        speed - the speed value.
      • getAIMoveSpeed

        float getAIMoveSpeed()
        Returns the AI move speed of the entity.
        Returns:
        the speed.
      • setAbsorptionAmount

        void setAbsorptionAmount​(float amount)
        Sets the absorption (extra health) amount.
        Parameters:
        amount - the absorption amount.
      • getAbsorptionAmount

        float getAbsorptionAmount()
        Returns the absorption (extra health) amount.
        Returns:
        the absorption amount.