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-05-07 11:28:13 +02:00
parent 9871bb85d8
commit 2eb1761e76
2 changed files with 3 additions and 1 deletions
@@ -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;