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/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 63d93060b350069040876aaacb91c853d674ea7b..e9793954c872baacfe7be80ecf3888e848dc924f 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -856,7 +856,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/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 52bd6b4a3bcd44166bd4c897756fe06b19120907..f59d18195bf40f5589d50cee8d074005e98416a6 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -2977,6 +2977,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/world/entity/animal/EntitySnowman.java b/src/main/java/net/minecraft/world/entity/animal/EntitySnowman.java
index 17f27d2bf5be746a0fa0e1e0fecab8158b2b3587..ad30cc92333aabf7d9fb3fb046e7ecb63629ee5b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntitySnowman.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntitySnowman.java
@@ -108,7 +108,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/world/entity/monster/EntityBlaze.java b/src/main/java/net/minecraft/world/entity/monster/EntityBlaze.java
index 45e69d2f8da4c5babfd2e67055cc0a4c6d3baac7..f90a0fcd41996cfb6935a2299306e6a4bf19701a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityBlaze.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityBlaze.java
@@ -143,7 +143,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/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
index ea500a6080f73dcc35d83a3b5a170f57dedaa431..d290787f74579dd4c138eb827e44544814bfe315 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -290,7 +290,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/world/entity/monster/EntityStrider.java b/src/main/java/net/minecraft/world/entity/monster/EntityStrider.java
index 5e4cc99a746d98231bbb71672fbc02431e4fab48..f52ae7446c16d5b8ac51bd2e12bb51d221ca43ca 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityStrider.java
@@ -405,7 +405,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 b701402cf9109aa9729bd3ab5585d24532147246..6036f39cd3aaeee459cbb45d9e3bd7450b6f08b0 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -583,6 +583,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);
@@ -593,6 +594,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;
@@ -807,6 +809,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);
@@ -819,6 +822,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;
@@ -1508,6 +1512,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);
@@ -1525,6 +1530,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;
@@ -1578,6 +1584,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);
@@ -1589,6 +1596,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;
