From 8736217b0f2f571d1b6c4dc8ce94fcd4d87df576 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 28 Jun 2020 18:04:04 -0400
Subject: [PATCH] Fix player skulls rendering - Fixes #3672

---
 ...x-client-rendering-skulls-from-same-user.patch | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch
index 1041163eb7..03dc9c2cea 100644
--- a/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch
+++ b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch
@@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                if (nbttagcompound != null && nbttagcompound.hasKeyOfType("SkullOwner", 10)) {
 +                    NBTTagCompound owner = nbttagcompound.getCompound("SkullOwner");
 +                    if (owner.hasKey("Id")) {
-+                        nbttagcompound.setString("SkullOwnerOrig", owner.getString("Id"));
++                        nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id"));
 +                        TileEntitySkull.sanitizeUUID(owner);
 +                    }
 +                }
@@ -56,11 +56,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                // Paper start - Fix skulls of same owner - restore orig ID since we changed it on send to client
 +                if (itemstack.tag.hasKey("SkullOwnerOrig")) {
 +                    NBTTagCompound owner = itemstack.tag.getCompound("SkullOwner");
-+                    String ownerOrig = itemstack.tag.getString("SkullOwnerOrig");
-+                    if (!owner.isEmpty() && !ownerOrig.isEmpty()) {
-+                        owner.setString("Id", ownerOrig);
++                    if (itemstack.tag.hasUUID("SkullOwnerOrig")) {
++                        owner.setUUID("Id", itemstack.tag.getUUID("SkullOwnerOrig"));
++                        itemstack.tag.remove("SkullOwnerOrig");
 +                    }
-+                    itemstack.tag.remove("SkullOwnerOrig");
 +                }
 +                // Paper end
 +                // CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); // Paper - This is no longer needed due to NBT being supported
@@ -110,12 +109,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        if (list != null && !list.isEmpty()) {
 +            String textures = ((NBTTagCompound)list.get(0)).getString("Value");
 +            if (textures != null && textures.length() > 3) {
-+                String uuid = UUID.nameUUIDFromBytes(textures.getBytes()).toString();
-+                owner.setString("Id", uuid);
++                UUID uuid = UUID.nameUUIDFromBytes(textures.getBytes());
++                owner.setUUID("Id", uuid);
 +                return;
 +            }
 +        }
-+        owner.setString("Id", UUID.randomUUID().toString());
++        owner.setUUID("Id", UUID.randomUUID());
 +    }
 +    // Paper end
 +