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/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index 90b90fa33b39020189a1d4a5826fa3ab720488cd..b4db9869d172406f4eff84cfb2648b5c6c6d00e2 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -116,7 +116,7 @@ public class EntityBlaze extends EntityMonster {
 
     @Override
     public boolean dO() {
-        return true;
+        return world.purpurConfig.blazeTakeDamageFromWater; // Purpur - Toggle for water sensitive mob damage
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index beee80c3d8277f2d784fb6b8a4152a871ee020b0..b884addf2ce6f1ef7394658078deb2e75370654f 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -234,7 +234,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
 
     @Override
     public boolean dO() {
-        return true;
+        return world.purpurConfig.endermanTakeDamageFromWater; // Purpur - Toggle for water sensitive mob damage
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 08efc5fec023acf68da1b5931a9b5eb8c16e9fc3..d6a086f59d9df8ef7f727e6a83fa51a14995123e 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -786,7 +786,8 @@ public abstract class EntityInsentient extends EntityLiving {
                 if (goalFloat.validConditions()) goalFloat.update();
                 this.getControllerJump().jumpIfSet();
             }
-            if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) {
+
+            if (isSensitiveToWater() && isInWaterOrRainOrBubble()) { // Purpur - Toggle for water sensitive mob damage
                 damageEntity(DamageSource.DROWN, 1.0F);
             }
             return;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 38f94d4983b69e265441a2b8365702df57a881f5..50fa5f8395fea3ba6fa202a5a38519cd55ae00e0 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2876,6 +2876,7 @@ public abstract class EntityLiving extends Entity {
 
     }
 
+    public boolean isSensitiveToWater() { return dO(); } // Purpur - OBFHELPER
     public boolean dO() {
         return false;
     }
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index eb6344a5671408ae9fdd6013774baa13addf304b..663c6dd23e0aa75266cefc8f0514d2ca9dc51553 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -71,7 +71,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt
 
     @Override
     public boolean dO() {
-        return true;
+        return world.purpurConfig.snowGolemTakeDamageFromWater; // Purpur - Toggle for water sensitive mob damage
     }
 
     @Override
diff --git a/src/main/java/net/minecraft/server/EntityStrider.java b/src/main/java/net/minecraft/server/EntityStrider.java
index 964956a0027bf0941ff75d658be760b754772fa0..7c5472a5138011a3376b7b6ec2467bdfc1739033 100644
--- a/src/main/java/net/minecraft/server/EntityStrider.java
+++ b/src/main/java/net/minecraft/server/EntityStrider.java
@@ -338,7 +338,7 @@ public class EntityStrider extends EntityAnimal implements ISteerable, ISaddleab
 
     @Override
     public boolean dO() {
-        return true;
+        return world.purpurConfig.striderTakeDamageFromWater; // Purpur - Toggle for water sensitive mob damage
     }
 
     @Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 2db8241602382927ae9365a5026451e199f48d36..9973677fb2ebce985b25efddc1015c6d5f0758a8 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -569,6 +569,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);
@@ -579,6 +580,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;
@@ -793,6 +795,7 @@ public class PurpurWorldConfig {
     public boolean endermanBypassMobGriefing = false;
     public boolean endermanDespawnEvenWithBlock = false;
     public double endermanMaxHealth = 40.0D;
+    public boolean endermanTakeDamageFromWater = true;
     private void endermanSettings() {
         endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
         endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
@@ -805,6 +808,7 @@ public class PurpurWorldConfig {
             set("mobs.enderman.attributes.max_health", oldValue);
         }
         endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
+        endermanTakeDamageFromWater = getBoolean("mobs.enderman.takes-damage-from-water", endermanTakeDamageFromWater);
     }
 
     public boolean endermiteRidable = false;
@@ -1492,6 +1496,7 @@ public class PurpurWorldConfig {
     public float snowGolemSnowBallModifier = 10.0F;
     public double snowGolemAttackDistance = 1.25D;
     public double snowGolemMaxHealth = 4.0D;
+    public boolean snowGolemTakeDamageFromWater = true;
     private void snowGolemSettings() {
         snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
         snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
@@ -1509,6 +1514,7 @@ public class PurpurWorldConfig {
             set("mobs.snow_golem.attributes.max_health", oldValue);
         }
         snowGolemMaxHealth = getDouble("mobs.snow_golem.attributes.max_health", snowGolemMaxHealth);
+        snowGolemTakeDamageFromWater = getBoolean("mobs.snow_golem.takes-damage-from-water", snowGolemTakeDamageFromWater);
     }
 
     public boolean squidRidable = false;
@@ -1562,6 +1568,7 @@ public class PurpurWorldConfig {
     public int striderBreedingTicks = 6000;
     public boolean striderGiveSaddleBack = false;
     public double striderMaxHealth = 20.0D;
+    public boolean striderTakeDamageFromWater = true;
     private void striderSettings() {
         striderRidable = getBoolean("mobs.strider.ridable", striderRidable);
         striderRidableInWater = getBoolean("mobs.strider.ridable-in-water", striderRidableInWater);
@@ -1573,6 +1580,7 @@ public class PurpurWorldConfig {
             set("mobs.strider.attributes.max_health", oldValue);
         }
         striderMaxHealth = getDouble("mobs.strider.attributes.max_health", striderMaxHealth);
+        striderTakeDamageFromWater = getBoolean("mobs.strider.takes-damage-from-water", striderTakeDamageFromWater);
     }
 
     public boolean tropicalFishRidable = false;
