From 2eb1761e767f8bad6a7bcc4e2ac713c856c650db Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Fri, 28 Apr 2023 20:42:09 +0200 Subject: [PATCH] Use exploding sheep as source for explosion. Makes the sheep entity the source of the explosion that's created when it triggers close to a player. This, in turn, makes the damage event listener handle the explosion damage as if the sheep is the damager, which means it will respect the `monster-infight` flag. Fixes #758 --- changelog.md | 2 ++ src/main/java/com/garbagemule/MobArena/waves/SheepBouncer.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index f72c5cb..a83b0c2 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,8 @@ These changes will (most likely) be included in the next version. ## [Unreleased] +### Fixed +- Explosion damage caused by Exploding Sheep now correctly counts as monster damage. This means that the explosions only affect other mobs if the per-arena setting `monster-infight` is set to `true`. ## [0.107] - 2022-07-30 ### Added diff --git a/src/main/java/com/garbagemule/MobArena/waves/SheepBouncer.java b/src/main/java/com/garbagemule/MobArena/waves/SheepBouncer.java index 9bd1a85..16aa2a6 100644 --- a/src/main/java/com/garbagemule/MobArena/waves/SheepBouncer.java +++ b/src/main/java/com/garbagemule/MobArena/waves/SheepBouncer.java @@ -74,7 +74,7 @@ public class SheepBouncer implements Runnable // Create an explosion if there's a player amongst the nearby entities. for (Entity entity : e.getNearbyEntities(2D, 2D, 2D)) { if (entity instanceof Player) { - e.getWorld().createExplosion(e.getLocation(), 2f); + e.getWorld().createExplosion(e.getLocation(), 2f, false, true, e); e.remove(); break;