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/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 1c8742e272e984d9a093d049b9420036ffc284a1..118f1c6a349ad49d87f14a1b8ae9ef64ccb1148a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1165,7 +1165,7 @@ public abstract class LivingEntity extends Entity implements Attackable { 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 cd59500565a305757872aaf41b03b49ffc005af5..703068eaff84bcce83f61d805afa6cc0fef909b1 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 @@ -605,7 +605,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 6241baccd3fdee59175f616cdf69d3873074f855..9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -135,7 +135,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 62943d43b701d9ae6d955003f4e7658f76d5bdb3..3dcd43279ce1295b37c3504ecbdaac5275df2b80 100644 --- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java @@ -128,6 +128,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 } }