Fix player skulls rendering - Fixes #3672

This commit is contained in:
Aikar 2020-06-28 18:04:04 -04:00
parent 5000be556c
commit 8736217b0f

View file

@ -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
+