Check mob-damage for potion splashes from e.g. witches.

Note that bypass bypasses this if the player with bypass is the target of the potion, but only for the player with bypass.

Fixes #2134.
This commit is contained in:
wizjany 2024-09-08 13:40:13 -04:00
parent 2ea50689b9
commit b73a0a7179
No known key found for this signature in database
GPG Key ID: 1DB5861C03B76B5E

View File

@ -1015,7 +1015,6 @@ public void onPotionSplash(PotionSplashEvent event) {
// Fire item interaction event
Events.fireToCancel(event, new UseItemEvent(event, cause, world, potion.getItem()));
// Fire entity interaction event
if (!event.isCancelled()) {
int blocked = 0;
@ -1027,8 +1026,11 @@ public void onPotionSplash(PotionSplashEvent event) {
? new DamageEntityEvent(event, cause, affected) :
new UseEntityEvent(event, cause, affected);
// Consider the potion splash flag
// Consider extra relevant flags
delegate.getRelevantFlags().add(Flags.POTION_SPLASH);
if (potion.getShooter() instanceof LivingEntity shooter && !(shooter instanceof Player) && affected instanceof Player) {
delegate.getRelevantFlags().add(Flags.MOB_DAMAGE);
}
if (Events.fireAndTestCancel(delegate)) {
event.setIntensity(affected, 0);