Class EntityMob

All Implemented Interfaces:
LogicalUtils, EntityAgeable, EntityAsyncPrepare, EntityCanAttack, EntityDamageable, EntityNameable, EntityInventoryHolder, InventoryHolder, Metadatable, Cloneable
Direct Known Subclasses:
EntityAmphibiousMob, EntityFlyingMob, EntitySwimmingMob, EntityWalkingMob

public abstract class EntityMob extends EntityIntelligent implements EntityInventoryHolder, EntityCanAttack
Author:
MagicDroidX (Nukkit Project)
  • Field Details

    • diffHandDamage

      protected float[] diffHandDamage
      不同难度下实体空手能造成的伤害.

      The damage that can be caused by the entity's empty hand at different difficulties.

  • Constructor Details

  • Method Details

    • initEntity

      protected void initEntity()
      Overrides:
      initEntity in class EntityIntelligent
    • spawnToAll

      public void spawnToAll()
      Overrides:
      spawnToAll in class Entity
    • spawnTo

      public void spawnTo(Player player)
      Overrides:
      spawnTo in class Entity
    • saveNBT

      public void saveNBT()
      Overrides:
      saveNBT in class EntityCreature
    • attack

      public boolean attack(EntityDamageEvent source)
      Description copied from class: Entity
      当一个实体被攻击时(即接受一个实体伤害事件 这个事件可以是由其他实体攻击导致,也可能是自然伤害)调用.

      Called when an entity is attacked (i.e. receives an entity damage event. This event can be caused by an attack by another entity, or it can be a natural damage).

      Overrides:
      attack in class EntityIntelligent
      Parameters:
      source - 记录伤害源的事件
      Record the event of the source of the attack
      Returns:
      是否攻击成功
      Whether the attack was successful
    • setOnFire

      public void setOnFire(int seconds)
      Overrides:
      setOnFire in class Entity
    • calculateEnchantmentProtectionFactor

      protected double calculateEnchantmentProtectionFactor(Item item, EntityDamageEvent source)
    • damageArmor

      @PowerNukkitOnly @Since("1.4.0.0-PN") protected Item damageArmor(Item armor, Entity damager)
    • getInventory

      public Inventory getInventory()
      Specified by:
      getInventory in interface InventoryHolder
    • canEquipByDispenser

      public boolean canEquipByDispenser()
      Specified by:
      canEquipByDispenser in interface EntityInventoryHolder
    • getDiffHandDamage

      public float[] getDiffHandDamage()
      Description copied from interface: EntityCanAttack
      得到所有难度下不携带物品能造成的伤害.

      Get the damage you can do without carrying items on all difficulties.

      Specified by:
      getDiffHandDamage in interface EntityCanAttack
      Returns:
      一个包含所有难度下伤害的数组, 0 1 2分别代表简单、普通、困难难度
      An array containing damage on all difficulties, 0 1 2 for easy, normal and hard difficulties respectively
    • getDiffHandDamage

      public float getDiffHandDamage(int difficulty)
      Description copied from interface: EntityCanAttack
      得到指定难度下不携带物品能造成的伤害.

      Get the damage that can be dealt without carrying the item at the specified difficulty.

      Specified by:
      getDiffHandDamage in interface EntityCanAttack
      Parameters:
      difficulty - 难度id
      difficulty id
      Returns:
      伤害
      damage
    • attackTarget

      public boolean attackTarget(Entity entity)
      Specified by:
      attackTarget in interface EntityCanAttack
    • getEquipmentInventory

      public EntityEquipmentInventory getEquipmentInventory()
      Specified by:
      getEquipmentInventory in interface EntityInventoryHolder
    • getArmorInventory

      public EntityArmorInventory getArmorInventory()
      Specified by:
      getArmorInventory in interface EntityInventoryHolder