From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Sat, 13 Mar 2021 14:02:04 -0600
Subject: [PATCH] Cache entityhuman display name


diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 44038dd278b988508047023107683e5370af54ad..ad85dda5c50b797904824a08513fbcec042128ea 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -162,7 +162,8 @@ public abstract class EntityHuman extends EntityLiving {
     protected int bG;
     protected final float bH = 0.02F;
     private int g;
-    private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER
+    private IChatBaseComponent displayName; // Airplane - cache displayName
+    private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; this.displayName = null; } // Paper - OBFHELPER // Airplane - use to reset displayName
     private ItemStack bL;
     private final ItemCooldown bM;
     @Nullable
@@ -1828,7 +1829,12 @@ public abstract class EntityHuman extends EntityLiving {
 
     @Override
     public IChatBaseComponent getDisplayName() {
-        return new ChatComponentText(this.bJ.getName());
+        // Airplane start - cache display name
+        if (this.displayName == null) {
+            this.displayName = new ChatComponentText(this.getProfile().getName());
+        }
+        return this.displayName;
+        // Airplane end
     }
 
     public InventoryEnderChest getEnderChest() {
