2021-07-10 04:49:49 +00:00
|
|
|
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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-11-09 07:59:15 +00:00
|
|
|
index ff7766553743172cb83049ed89532eba596f39b6..d16e3be9e64db9cba4bb90cccd170aa92534b76a 100644
|
2021-07-10 04:49:49 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-11-09 07:59:15 +00:00
|
|
|
@@ -714,6 +714,21 @@ public class PaperWorldConfig {
|
2021-07-10 04:49:49 +00:00
|
|
|
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
|
2021-11-09 07:59:15 +00:00
|
|
|
index bd2e2eece61fd7fa6ab63d8926308044ceaa4012..2a16984f417967cf11838b1a05d60b9d49af91c3 100644
|
2021-07-10 04:49:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
@@ -1133,7 +1133,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.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
|
2021-10-05 03:14:11 +00:00
|
|
|
index 9a5294596eb50cf4f6cf0729f6b94faaa63a5871..8c17caf00bd24adca5794774171638f298921ee7 100644
|
2021-07-10 04:49:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
|
|
@@ -602,7 +602,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.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
|
2021-10-05 03:14:11 +00:00
|
|
|
index 968907f6aae3f58cddac1967bcfd82cea8800912..64f0ce2981700532cb0d11fbc086bfbd08f2384d 100644
|
2021-07-10 04:49:49 +00:00
|
|
|
--- 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.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
|
2021-10-05 03:14:11 +00:00
|
|
|
index c727bbf7de71213fba410625c4a7ad90315b608a..6acc46c3a6fe7648d2cc4d0aaef063633c74c20d 100644
|
2021-07-10 04:49:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
|
|
|
@@ -122,6 +122,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.witherSkeletonImmuneToWitherEffect ? false : super.canBeAffected(effect); // Paper
|
|
|
|
}
|
|
|
|
}
|