From dcdec7d59c6283bd582d66e1d03b00cd7971296f Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 9 Jul 2021 21:49:49 -0700 Subject: [PATCH] Add config for mobs immune to default effects (#4835) --- ...g-for-mobs-immune-to-default-effects.patch | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 patches/server/Add-config-for-mobs-immune-to-default-effects.patch diff --git a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch new file mode 100644 index 0000000000..9d90814e5a --- /dev/null +++ b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); + } + ++ public boolean undeadImmuneToCertainEffects = true; ++ public boolean spidersImmuneToPoisonEffect = true; ++ public boolean witherImmuneToWitherEffect = true; ++ public boolean witherSkeletonImmuneToWitherEffect = true; ++ private void mobEffectChanges() { ++ undeadImmuneToCertainEffects = getBoolean("mob-effects.undead-immune-to-certain-effects", undeadImmuneToCertainEffects); ++ log("Undead immune to harmful effects: " + undeadImmuneToCertainEffects); ++ spidersImmuneToPoisonEffect = getBoolean("mob-effects.spiders-immune-to-poison-effect", spidersImmuneToPoisonEffect); ++ log("Spiders immune to poison effect: " + spidersImmuneToPoisonEffect); ++ witherImmuneToWitherEffect = getBoolean("mob-effects.immune-to-wither-effect.wither", witherImmuneToWitherEffect); ++ log("Wither immune to wither effect: " + witherImmuneToWitherEffect); ++ witherSkeletonImmuneToWitherEffect = getBoolean("mob-effects.immune-to-wither-effect.wither-skeleton", witherSkeletonImmuneToWitherEffect); ++ log("Wither skeleton immune to wither effect: " + witherSkeletonImmuneToWitherEffect); ++ } ++ + public boolean nerfNetherPortalPigmen = false; + private void nerfNetherPortalPigmen() { + nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -0,0 +0,0 @@ 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.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ 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.witherImmuneToWitherEffect ? 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java +@@ -0,0 +0,0 @@ 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.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java ++++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java +@@ -0,0 +0,0 @@ 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.witherSkeletonImmuneToWitherEffect ? false : super.canBeAffected(effect); // Paper + } + }