Fix case where some skulls still have string UUID's

These heads are technically outdated, but this patch shouldn't care about
what format the original value was in, so keep it the same.
This commit is contained in:
Aikar 2020-06-28 20:33:14 -04:00
parent 9073cfa452
commit 8806d0a89a
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -25,7 +25,7 @@ index 7b2010ec4955fb5788c60178c6e306ea3098e9ba..95e801a9a7ca405ff7e80c920fa78493
private Entity k; private Entity k;
private ShapeDetectorBlock l; private ShapeDetectorBlock l;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..a7560ac0719d789f2b8ebc0294190a9bd43a2512 100644 index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..91235f7bc80967a759ed8bb25d74ff0af6e25ef4 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -274,9 +274,18 @@ public class PacketDataSerializer extends ByteBuf { @@ -274,9 +274,18 @@ public class PacketDataSerializer extends ByteBuf {
@ -40,7 +40,7 @@ index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..a7560ac0719d789f2b8ebc0294190a9b
+ if (nbttagcompound != null && nbttagcompound.hasKeyOfType("SkullOwner", 10)) { + if (nbttagcompound != null && nbttagcompound.hasKeyOfType("SkullOwner", 10)) {
+ NBTTagCompound owner = nbttagcompound.getCompound("SkullOwner"); + NBTTagCompound owner = nbttagcompound.getCompound("SkullOwner");
+ if (owner.hasKey("Id")) { + if (owner.hasKey("Id")) {
+ nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id")); + nbttagcompound.map.put("SkullOwnerOrig", owner.map.get("Id"));
+ TileEntitySkull.sanitizeUUID(owner); + TileEntitySkull.sanitizeUUID(owner);
+ } + }
+ } + }
@ -56,8 +56,8 @@ index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..a7560ac0719d789f2b8ebc0294190a9b
+ // Paper start - Fix skulls of same owner - restore orig ID since we changed it on send to client + // Paper start - Fix skulls of same owner - restore orig ID since we changed it on send to client
+ if (itemstack.tag.hasKey("SkullOwnerOrig")) { + if (itemstack.tag.hasKey("SkullOwnerOrig")) {
+ NBTTagCompound owner = itemstack.tag.getCompound("SkullOwner"); + NBTTagCompound owner = itemstack.tag.getCompound("SkullOwner");
+ if (itemstack.tag.hasUUID("SkullOwnerOrig")) { + if (itemstack.tag.hasKey("SkullOwnerOrig")) {
+ owner.setUUID("Id", itemstack.tag.getUUID("SkullOwnerOrig")); + owner.map.put("Id", itemstack.tag.map.get("SkullOwnerOrig"));
+ itemstack.tag.remove("SkullOwnerOrig"); + itemstack.tag.remove("SkullOwnerOrig");
+ } + }
+ } + }