From 7b732f6ccf0ac1668f6648ed2c253f797a4a1e10 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:31:00 +0100 Subject: [PATCH 1/3] Fix players being able to attack their own mascot --- .../city/sub/mascots/listeners/MascotsDamageListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..310df9868 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,7 +37,8 @@ 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 ); @EventHandler From 966b433a223563e447b1043d20f941f3f30c4ac4 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:40:31 +0100 Subject: [PATCH 2/3] Add doc and remove useless check --- .../city/sub/mascots/listeners/MascotsDamageListener.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 310df9868..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 @@ -38,15 +38,12 @@ public class MascotsDamageListener implements Listener { EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, EntityDamageEvent.DamageCause.FIRE_TICK, - EntityDamageEvent.DamageCause.ENTITY_ATTACK + 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(); From b3570aac40ce604b85cdbcf8885c5a9369337643 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:52:18 +0100 Subject: [PATCH 3/3] Fix mascots not taking damage correctly --- .../core/features/city/sub/mascots/utils/MascotUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); } }