diff --git a/src/main/java/fr/openmc/core/features/city/sub/mascots/listeners/MascotsDamageListener.java b/src/main/java/fr/openmc/core/features/city/sub/mascots/listeners/MascotsDamageListener.java index 8f3d1e6a8..6c1656675 100644 --- a/src/main/java/fr/openmc/core/features/city/sub/mascots/listeners/MascotsDamageListener.java +++ b/src/main/java/fr/openmc/core/features/city/sub/mascots/listeners/MascotsDamageListener.java @@ -37,15 +37,13 @@ public class MascotsDamageListener implements Listener { EntityDamageEvent.DamageCause.LIGHTNING, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, - EntityDamageEvent.DamageCause.FIRE_TICK + EntityDamageEvent.DamageCause.FIRE_TICK, + EntityDamageEvent.DamageCause.ENTITY_ATTACK // Fix le fait de pouvoir attaquer sa propre mascotte ); @EventHandler void onMascotDamageCaused(EntityDamageEvent e) { if (!(e.getEntity() instanceof LivingEntity entity)) return; - - if (entity instanceof Player) return; - if (!MascotUtils.canBeAMascot(entity)) return; EntityDamageEvent.DamageCause cause = e.getCause(); diff --git a/src/main/java/fr/openmc/core/features/city/sub/mascots/utils/MascotUtils.java b/src/main/java/fr/openmc/core/features/city/sub/mascots/utils/MascotUtils.java index 991ce6f64..0b7410679 100644 --- a/src/main/java/fr/openmc/core/features/city/sub/mascots/utils/MascotUtils.java +++ b/src/main/java/fr/openmc/core/features/city/sub/mascots/utils/MascotUtils.java @@ -64,8 +64,6 @@ public static boolean canBeAMascot(Entity entity) { } public static void updateDisplayName(LivingEntity entityMascot, Mascot mascot, double damage) { - double newHealth = Math.floor(entityMascot.getHealth()); - entityMascot.setHealth(newHealth); AttributeInstance maxHealthInst = entityMascot.getAttribute(Attribute.MAX_HEALTH); if (maxHealthInst == null) return; double maxHealth = maxHealthInst.getValue(); @@ -81,6 +79,7 @@ public static void updateDisplayName(LivingEntity entityMascot, Mascot mascot, d healthAfterDamage, maxHealth ))); + entityMascot.setHealth(healthAfterDamage); } }