Class EntityMob

All Implemented Interfaces:
EntityControlUtils, LogicalUtils, EntityAgeable, EntityAsyncPrepare, EntityCanAttack, EntityDamageable, EntityNameable, EntityInventoryHolder, InventoryHolder, Metadatable, Cloneable
Direct Known Subclasses:
EntityBlaze, EntityCaveSpider, EntityCreeper, EntityDrowned, EntityElderGuardian, EntityEnderDragon, EntityEnderman, EntityEndermite, EntityEvoker, EntityGhast, EntityGuardian, EntityHoglin, EntityIronGolem, EntityMagmaCube, EntityPhantom, EntityPiglin, EntityPiglinBrute, EntityPillager, EntityRavager, EntityShulker, EntitySilverfish, EntitySkeleton, EntitySlime, EntitySnowGolem, EntitySpider, EntityStray, EntityVex, EntityVindicator, EntityWarden, EntityWitch, EntityWither, EntityWitherSkeleton, EntityZoglin, EntityZombie, EntityZombiePigman, EntityZombieVillager, EntityZombieVillagerV1

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()
      Description copied from class: Entity
      实体初始化顺序,先初始化Entity类字段->Entity构造函数->进入init方法->调用initEntity方法->子类字段初始化->子类构造函数

      用于初始化实体的NBT和实体字段的方法

      Entity initialization order, first initialize the Entity class field->Entity constructor->Enter the init method->Call the init Entity method-> subclass field initialization-> subclass constructor

      The method used to initialize the NBT and entity fields of the entity

      Overrides:
      initEntity in class EntityIntelligent
    • onUpdate

      public boolean onUpdate(int currentTick)
      Overrides:
      onUpdate in class EntityPhysical
    • spawnToAll

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

      public void spawnTo(Player player)
      Description copied from class: Entity
      将这个实体在客户端生成,让该玩家可以看到它

      Spawn this entity on the client side so that the player can see it

      Overrides:
      spawnTo in class Entity
      Parameters:
      player - the player
    • saveNBT

      public void saveNBT()
      Overrides:
      saveNBT in class EntityIntelligent
    • 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
    • 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