Interface EntityCanAttack

All Known Implementing Classes:
EntityBlaze, EntityCat, EntityCaveSpider, EntityCreeper, EntityDrowned, EntityElderGuardian, EntityEnderDragon, EntityEnderman, EntityEndermite, EntityEvoker, EntityGhast, EntityGuardian, EntityHoglin, EntityHusk, EntityIronGolem, EntityMagmaCube, EntityMob, EntityPhantom, EntityPiglin, EntityPiglinBrute, EntityPillager, EntityRavager, EntityShulker, EntitySilverfish, EntitySkeleton, EntitySlime, EntitySnowGolem, EntitySpider, EntityStray, EntityVex, EntityVindicator, EntityWarden, EntityWitch, EntityWither, EntityWitherSkeleton, EntityWolf, EntityZoglin, EntityZombie, EntityZombiePigman, EntityZombieVillager, EntityZombieVillagerV1

@PowerNukkitXOnly @Since("1.19.30-r1") public interface EntityCanAttack
代表可以攻击其他实体的实体.

Represents an entity that can attack other entities.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    default float[]
    得到所有难度下不携带物品能造成的伤害.
    default float
    getDiffHandDamage(int difficulty)
    得到指定难度下不携带物品能造成的伤害.
  • Field Details

    • EMPTY_FLOAT_ARRAY

      static final float[] EMPTY_FLOAT_ARRAY
  • Method Details

    • getDiffHandDamage

      default float[] getDiffHandDamage()
      得到所有难度下不携带物品能造成的伤害.

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

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

      default float getDiffHandDamage(int difficulty)
      得到指定难度下不携带物品能造成的伤害.

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

      Parameters:
      difficulty - 难度id
      difficulty id
      Returns:
      伤害
      damage
    • attackTarget

      @PowerNukkitXOnly @Since("1.19.50-r3") boolean attackTarget(Entity entity)