From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 9 Mar 2021 16:10:39 -0500
Subject: [PATCH] Config for Enderman to aggro spawned Endermites

By default, Enderman do not attack Endermites unless spawned by an Ender Pearl.

diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index b884addf2ce6f1ef7394658078deb2e75370654f..6c60253fee2098889292837033396f0dcd75c4b7 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -16,7 +16,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
     private static final DataWatcherObject<Boolean> bo = DataWatcher.a(EntityEnderman.class, DataWatcherRegistry.i);
     private static final DataWatcherObject<Boolean> bp = DataWatcher.a(EntityEnderman.class, DataWatcherRegistry.i);
     private static final Predicate<EntityLiving> bq = (entityliving) -> {
-        return entityliving instanceof EntityEndermite && ((EntityEndermite) entityliving).isPlayerSpawned();
+        return entityliving instanceof EntityEndermite && (((EntityEndermite) entityliving).isPlayerSpawned() || entityliving.world.purpurConfig.endermanAggroSpawnedEndermites); // Purpur
     };
     private int br = Integer.MIN_VALUE;
     private int bs;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 839b76e406d9374c1b3aff7adee82acaa7d89dc9..28814c8b5ecab56fca113e741305ac5dc4f49e8c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -821,6 +821,7 @@ public class PurpurWorldConfig {
     public boolean endermanDespawnEvenWithBlock = false;
     public double endermanMaxHealth = 40.0D;
     public boolean endermanTakeDamageFromWater = true;
+    public boolean endermanAggroSpawnedEndermites = false;
     private void endermanSettings() {
         endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
         endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
@@ -834,6 +835,7 @@ public class PurpurWorldConfig {
         }
         endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
         endermanTakeDamageFromWater = getBoolean("mobs.enderman.takes-damage-from-water", endermanTakeDamageFromWater);
+        endermanAggroSpawnedEndermites = getBoolean("mobs.enderman.aggressive-towards-spawned-endermites", endermanAggroSpawnedEndermites);
     }
 
     public boolean endermiteRidable = false;
