From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 10 Aug 2020 21:46:22 -0500
Subject: [PATCH] Short enderman height


diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 7b175240e44b0c7eb5044d7bcaf54dac22f50f2a..e3364032669b473c799b759f5f89468b7584d9f5 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -321,6 +321,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
     public boolean damageEntity(DamageSource damagesource, float f) {
         if (this.isInvulnerable(damagesource)) {
             return false;
+        } else if (net.pl3x.purpur.PurpurConfig.endermanShortHeight && damagesource == DamageSource.STUCK) { return false; // Purpur - no suffocation damage if short height
         } else if (damagesource instanceof EntityDamageSourceIndirect) {
             if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
             for (int i = 0; i < 64; ++i) {
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index ed1e0bd379b95bc090c7cdf57de70ec9cc2dac5a..06fe0fca1936853748997c63f325df99da5fa2ee 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -137,7 +137,8 @@ public class EntityTypes<T extends Entity> {
     private IChatBaseComponent bp;
     @Nullable
     private MinecraftKey bq;
-    private final EntitySize br;
+    public void setEntitySize(EntitySize entitySize) { this.br = entitySize; } // Purpur - OBFHELPER
+    private EntitySize br; // Purpur - remove final
 
     private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
         return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 17a8b43892fdab87a80cbf076c7814bfab087142..c314a8c9a921a95cea43b748e2037521d948e1e7 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -2,6 +2,8 @@ package net.pl3x.purpur;
 
 import co.aikar.timings.TimingsManager;
 import com.google.common.base.Throwables;
+import net.minecraft.server.EntitySize;
+import net.minecraft.server.EntityTypes;
 import net.minecraft.server.MinecraftServer;
 import net.pl3x.purpur.command.PurpurCommand;
 import org.bukkit.Bukkit;
@@ -191,6 +193,12 @@ public class PurpurConfig {
         enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
     }
 
+    public static boolean endermanShortHeight = false;
+    private static void entitySettings() {
+        endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
+        if (endermanShortHeight) EntityTypes.ENDERMAN.setEntitySize(EntitySize.b(0.6F, 1.9F));
+    }
+
     public static boolean dontSendUselessEntityPackets = false;
     private static void dontSendUselessEntityPackets() {
         dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
