From f4ba45bd74df5fa25f023b37f7ee4c39e0ac9335 Mon Sep 17 00:00:00 2001 From: maxanier Date: Wed, 11 Oct 2023 21:09:25 +0200 Subject: [PATCH] Disable Holy water damage when pvp is turned off. closes #1263 --- .../teamlapen/vampirism/items/HolyWaterSplashBottleItem.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/teamlapen/vampirism/items/HolyWaterSplashBottleItem.java b/src/main/java/de/teamlapen/vampirism/items/HolyWaterSplashBottleItem.java index d1e70a677b..688d6e4603 100644 --- a/src/main/java/de/teamlapen/vampirism/items/HolyWaterSplashBottleItem.java +++ b/src/main/java/de/teamlapen/vampirism/items/HolyWaterSplashBottleItem.java @@ -39,6 +39,9 @@ public void onImpact(ThrowableItemEntity entity, ItemStack stack, RayTraceResult if (!list1.isEmpty()) { for (LivingEntity entitylivingbase : list1) { + if(thrower instanceof PlayerEntity && entitylivingbase instanceof PlayerEntity && !((PlayerEntity)thrower).canHarmPlayer((PlayerEntity) entitylivingbase)){ + continue; + } DamageHandler.affectEntityHolyWaterSplash(entitylivingbase, getStrength(tier), entity.distanceToSqr(entitylivingbase), result.getType() == RayTraceResult.Type.ENTITY, thrower instanceof LivingEntity ? (LivingEntity) thrower : null); } }