PaperMC/patches/server/1032-Add-config-for-mobs-immune-to-default-effects.patch

45 lines
2.8 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 21:03:02 -0800
Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index c23d4ee0a16d1ae7168b2496d97189a14256bdcc..7ddca52f7fe3f289b4b867e134326b1ead1a2aee 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -604,7 +604,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.is(MobEffects.WITHER) ? false : super.canBeAffected(effect);
+ return effect.is(MobEffects.WITHER) && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
private class WitherDoNothingGoal extends Goal {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index ef8911f7bcf6a97496675abb4689bb09cf322e85..fa0316e9d2a4cf213982994dc8bf310299cca984 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -126,7 +126,7 @@ public class Spider extends Monster {
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.is(MobEffects.POISON) ? false : super.canBeAffected(effect);
+ return effect.is(MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
public boolean isClimbing() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
index 05e9b083f7e49bd7a24f04fd2c46acef6d011e48..3f1191795e58f31b7e2fe34ef2774df13b9a789f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
@@ -113,6 +113,6 @@ public class WitherSkeleton extends AbstractSkeleton {
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.is(MobEffects.WITHER) ? false : super.canBeAffected(effect);
+ return effect.is(MobEffects.WITHER) && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
}