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/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java
index 1bfde4cfc0f27705238abf7852ad9bb7997e23e6..2cf4e8f68fa85c4e09effda0da0c3a3f64ae7ba9 100644
--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java
+++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java
@@ -268,7 +268,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/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
index 72142f5c777c6218050bc2b69891072d256ea57d..52aa47036acee2ec21ae2d6f4df634ecbf04b3b0 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -383,6 +383,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/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 1d6da0c0753e822bba9d7847980235ff876e1ee8..76a1f157dc4ae0fdf804f3340b72dfa17ffbbb94 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -4,6 +4,8 @@ import co.aikar.timings.TimingsManager;
 import com.google.common.base.Throwables;
 import net.minecraft.locale.LocaleLanguage;
 import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.EntitySize;
+import net.minecraft.world.entity.EntityTypes;
 import net.pl3x.purpur.command.PurpurCommand;
 import org.bukkit.Bukkit;
 import org.bukkit.command.Command;
@@ -192,6 +194,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);
