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:
parent
9871bb85d8
commit
2eb1761e76
|
@ -11,6 +11,8 @@ These changes will (most likely) be included in the next version.
|
||||||
|
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
## [0.107] - 2022-07-30
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class SheepBouncer implements Runnable
|
||||||
// Create an explosion if there's a player amongst the nearby entities.
|
// Create an explosion if there's a player amongst the nearby entities.
|
||||||
for (Entity entity : e.getNearbyEntities(2D, 2D, 2D)) {
|
for (Entity entity : e.getNearbyEntities(2D, 2D, 2D)) {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
e.getWorld().createExplosion(e.getLocation(), 2f);
|
e.getWorld().createExplosion(e.getLocation(), 2f, false, true, e);
|
||||||
e.remove();
|
e.remove();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue