Interface EntityCanAttack

All Known Implementing Classes:
EntityAmphibiousMob, EntityBlaze, EntityCat, EntityCaveSpider, EntityCreeper, EntityDrowned, EntityElderGuardian, EntityEnderDragon, EntityEnderman, EntityEndermite, EntityEvoker, EntityFlyingMob, EntityGhast, EntityGuardian, EntityHoglin, EntityHusk, EntityIronGolem, EntityMagmaCube, EntityMob, EntityPhantom, EntityPiglin, EntityPiglinBrute, EntityPillager, EntityRavager, EntityShulker, EntitySilverfish, EntitySkeleton, EntitySlime, EntitySnowGolem, EntitySpider, EntityStray, EntitySwimmingMob, EntityVex, EntityVindicator, EntityWalkingMob, 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.

  • Method Summary

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

    • getDiffHandDamage

      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)