geforkt von Mirrors/Paper
cc6fd371b2
Fixes #6357 Closes #6508 Closes #6358
84 Zeilen
5.4 KiB
Diff
84 Zeilen
5.4 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 04b27d96d7a6396989c6a9d67b92af259dc0cc26..2bfadd245b5d08c1b77805ee049456cc786c093e 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -671,6 +671,21 @@ 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 429c229d7c88060c76b143ff4aa1bea88b2be786..2c49851c2113692d666ccdde6043c82370725010 100644
|
|
--- 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
|
|
index 6e3bd5146c687922e7b4680d59a1ae2d1480ad40..bb329e9c1a2295e6433d3728692a1e716c89dcc0 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
|
|
@@ -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
|
|
index e5679823786f2579f93a93a5ae08ab7ae42b390c..a8162116eb888106e6f48ee836d0cc5d33b72399 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.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 033d6389e4b7d986fc63abd67e325b68a6132824..f9bc07be70fae9aced51a69bccb5eda309187a47 100644
|
|
--- 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
|
|
}
|
|
}
|