public void AnimatorStandHandleDamage(EntityDamageEvent e) {
if (e.isCancelled()) return;
if (e.getEntity().getType().equals(EntityType.ARMOR_STAND) && e.getEntity().hasMetadata("asa")) {
ArmorStandAnimator asa = ArmorStandUtils.getAnimatorInstance(BukkitAdapter.adapt(e.getEntity()));
if (!asa.hasAI()) return;
e.setCancelled(true);
if (e instanceof EntityDamageByEntityEvent && !asa.isDying) {
EntityDamageByEntityEvent ee = (EntityDamageByEntityEvent) e;
AbstractEntity attacker = this.getAttacker(ee.getDamager());
if (!attacker.isPlayer()) {
asa.aiMob.getLivingEntity().damage(e.getDamage(), ee.getDamager());
}
}
}
}
My English is poor。
When a player attacks armor armor, the damage cannot be passed to aimob.
When damage is AoE from environment, aimob will be twice damaged
My English is poor。 When a player attacks armor armor, the damage cannot be passed to aimob. When damage is AoE from environment, aimob will be twice damaged