Paper/patches/server/0657-Add-config-for-mobs-immune-to-default-effects.patch
2022-12-07 21:16:54 +01:00

58 lines
3.6 KiB
Diff

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/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 97e8d9568f21888bc6b92fe7a8544372c8d0db71..36d27f64a837630d5056b0cf5a0b1b009d1d4f0f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1152,7 +1152,7 @@ public abstract class LivingEntity extends Entity {
if (this.getMobType() == MobType.UNDEAD) {
MobEffect mobeffectlist = effect.getEffect();
- if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) {
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level.paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper
return false;
}
}
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 b8d264848f917a698fc4dcd932fdcd78d487a80d..b781c849737225c00f1dd8d45a6d08cebc000263 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
@@ -609,7 +609,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper
}
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 d0d53d576a9bd79f721a8264a15bcfdd4a2132d0..001f6cf2ea3d664864f444a92dd71d069b9a38f5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -133,7 +133,7 @@ public class Spider extends Monster {
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.POISON && this.level.paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper
}
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 ea6233cb3ca30864e54d553a5d1071ea9147a868..6449213d717271bcc516e393a78dfe1e5c762d68 100644
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
@@ -123,6 +123,6 @@ public class WitherSkeleton extends AbstractSkeleton {
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper
}
}