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
This commit is contained in:
Andreas Troelsen 2023-04-28 20:42:09 +02:00
parent 9871bb85d8
commit 2eb1761e76
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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;