Replace PvP-enabled check with "can player damage other player" check

Fixes #3146
This commit is contained in:
Hubry committed 2020-01-18 22:08:51 +01:00
1 parent 11ea2ed845
commit 0840478c2a
1 file changed
+2 -3
@@ -21,7 +21,6 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
@@ -108,8 +107,8 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
LivingEntity thrower = entity.getThrower();
for(LivingEntity living : entities) {
if(living == thrower
|| ServerLifecycleHooks.getCurrentServer() != null && !ServerLifecycleHooks.getCurrentServer().isPVPEnabled())
if(living == thrower || living instanceof PlayerEntity && thrower instanceof PlayerEntity
&& ((PlayerEntity) thrower).canAttackPlayer(((PlayerEntity) living)))
continue;
if(living.hurtTime == 0) {