From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YouHaveTrouble <garrenpolska@gmail.com>
Date: Fri, 5 Feb 2021 01:11:22 +0100
Subject: [PATCH] Toggle for water sensitive mob damage


diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 30a566f84db07523367da7ca26fde6b9ad891b10..730f3e8c3d410363e55f1c3d7cfcc3c388e75aa9 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -865,7 +865,7 @@ public abstract class Mob extends LivingEntity {
                 if (goalFloat.canUse()) goalFloat.tick();
                 this.getJumpControl().tick();
             }
-            if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterRainOrBubble()) {
+            if (isSensitiveToWater() && isInWaterRainOrBubble()) { // Purpur
                 hurt(DamageSource.DROWN, 1.0F);
             }
             return;
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
index 0549e3d3cd3a9fddcb0d8edc56fb1fddc1c19802..37d2de60ea0fdb3fe4dcfd72f154b33bae675b74 100644
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
@@ -110,7 +110,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
 
     @Override
     public boolean isSensitiveToWater() {
-        return true;
+        return this.level.purpurConfig.snowGolemTakeDamageFromWater; // Purpur
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Blaze.java b/src/main/java/net/minecraft/world/entity/monster/Blaze.java
index 83f9a1139a501135a89a758993c7ff209b5b92d5..d772fcfc62425bb720003a681b987382603961f7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Blaze.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Blaze.java
@@ -138,7 +138,7 @@ public class Blaze extends Monster {
 
     @Override
     public boolean isSensitiveToWater() {
-        return true;
+        return this.level.purpurConfig.blazeTakeDamageFromWater; // Purpur
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 17e33ac7125d7474fe5f1ea2ca3d1916e016a1c8..5718b5941dc63987bad30efe5377476c60095b99 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -287,7 +287,7 @@ public class EnderMan extends Monster implements NeutralMob {
 
     @Override
     public boolean isSensitiveToWater() {
-        return true;
+        return this.level.purpurConfig.endermanTakeDamageFromWater; // Purpur
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
index 66dab9b4e5ae05deeae11c8588a0b855d8847bdc..19753a1855b11f8cdc9fb77e8d9079bbeb3c519b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
@@ -408,7 +408,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
 
     @Override
     public boolean isSensitiveToWater() {
-        return true;
+        return this.level.purpurConfig.striderTakeDamageFromWater; // Purpur
     }
 
     @Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index b578c89ed02b093e329ba93775a3552e5a568883..8e3d7bb364f9581dd27145672c87c3933b09b8af 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -634,6 +634,7 @@ public class PurpurWorldConfig {
     public boolean blazeRidableInWater = false;
     public double blazeMaxY = 256D;
     public double blazeMaxHealth = 20.0D;
+    public boolean blazeTakeDamageFromWater = true;
     private void blazeSettings() {
         blazeRidable = getBoolean("mobs.blaze.ridable", blazeRidable);
         blazeRidableInWater = getBoolean("mobs.blaze.ridable-in-water", blazeRidableInWater);
@@ -644,6 +645,7 @@ public class PurpurWorldConfig {
             set("mobs.blaze.attributes.max_health", oldValue);
         }
         blazeMaxHealth = getDouble("mobs.blaze.attributes.max_health", blazeMaxHealth);
+        blazeTakeDamageFromWater = getBoolean("mobs.blaze.takes-damage-from-water", blazeTakeDamageFromWater);
     }
 
     public boolean catRidable = false;
@@ -860,6 +862,7 @@ public class PurpurWorldConfig {
     public boolean endermanAllowGriefing = true;
     public boolean endermanDespawnEvenWithBlock = false;
     public boolean endermanBypassMobGriefing = false;
+    public boolean endermanTakeDamageFromWater = true;
     private void endermanSettings() {
         endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
         endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
@@ -872,6 +875,7 @@ public class PurpurWorldConfig {
         endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
         endermanDespawnEvenWithBlock = getBoolean("mobs.enderman.can-despawn-with-held-block", endermanDespawnEvenWithBlock);
         endermanBypassMobGriefing = getBoolean("mobs.enderman.bypass-mob-griefing", endermanBypassMobGriefing);
+        endermanTakeDamageFromWater = getBoolean("mobs.enderman.takes-damage-from-water", endermanTakeDamageFromWater);
     }
 
     public boolean endermiteRidable = false;
@@ -1557,6 +1561,7 @@ public class PurpurWorldConfig {
     public float snowGolemSnowBallModifier = 10.0F;
     public double snowGolemAttackDistance = 1.25D;
     public boolean snowGolemBypassMobGriefing = false;
+    public boolean snowGolemTakeDamageFromWater = true;
     private void snowGolemSettings() {
         snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
         snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
@@ -1574,6 +1579,7 @@ public class PurpurWorldConfig {
         snowGolemSnowBallModifier = (float) getDouble("mobs.snow_golem.snow-ball-modifier", snowGolemSnowBallModifier);
         snowGolemAttackDistance = getDouble("mobs.snow_golem.attack-distance", snowGolemAttackDistance);
         snowGolemBypassMobGriefing = getBoolean("mobs.snow_golem.bypass-mob-griefing", snowGolemBypassMobGriefing);
+        snowGolemTakeDamageFromWater = getBoolean("mobs.snow_golem.takes-damage-from-water", snowGolemTakeDamageFromWater);
     }
 
     public boolean squidRidable = false;
@@ -1627,6 +1633,7 @@ public class PurpurWorldConfig {
     public double striderMaxHealth = 20.0D;
     public int striderBreedingTicks = 6000;
     public boolean striderGiveSaddleBack = false;
+    public boolean striderTakeDamageFromWater = true;
     private void striderSettings() {
         striderRidable = getBoolean("mobs.strider.ridable", striderRidable);
         striderRidableInWater = getBoolean("mobs.strider.ridable-in-water", striderRidableInWater);
@@ -1638,6 +1645,7 @@ public class PurpurWorldConfig {
         striderMaxHealth = getDouble("mobs.strider.attributes.max_health", striderMaxHealth);
         striderBreedingTicks = getInt("mobs.strider.breeding-delay-ticks", striderBreedingTicks);
         striderGiveSaddleBack = getBoolean("mobs.strider.give-saddle-back", striderGiveSaddleBack);
+        striderTakeDamageFromWater = getBoolean("mobs.strider.takes-damage-from-water", striderTakeDamageFromWater);
     }
 
     public boolean traderLlamaRidable = false;
