From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paul Sauve 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 5bce47fa8f191bc1d33c04c9865cb0efd492a9a2..5f9e64df007ebc40f7bcb50be495b10e51d5b87a 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 @@ -1840,7 +1841,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() {