Fix supporting more places of the old UUID format

Fixes #3734
This commit is contained in:
Aikar 2020-07-01 03:13:57 -04:00
parent f5265d6688
commit d304722608
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 15 additions and 5 deletions

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..91235f7bc80967a759ed8bb25d74ff0af6e25ef4 100644 index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..7e116d83a62ef42e241ee9e05fdd7ecb30a2ed95 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 {
@ -39,8 +39,8 @@ index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..91235f7bc80967a759ed8bb25d74ff0a
+ // Paper start + // Paper start
+ 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.hasUUID("Id")) {
+ nbttagcompound.map.put("SkullOwnerOrig", owner.map.get("Id")); + nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id"));
+ TileEntitySkull.sanitizeUUID(owner); + TileEntitySkull.sanitizeUUID(owner);
+ } + }
+ } + }

View file

@ -8,10 +8,10 @@ We have stored UUID in plenty of places that did not get DFU'd
So just look for old format and load it if it exists. So just look for old format and load it if it exists.
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index f608b35502890650adfc1df35e0794471f57ecbc..93b25e4580646ccfe8c671511e2250dbe7474a89 100644 index f608b35502890650adfc1df35e0794471f57ecbc..74a8418b72f97a8956857a46fb06251602ad30e3 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java --- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -142,6 +142,11 @@ public class NBTTagCompound implements NBTBase { @@ -142,11 +142,21 @@ public class NBTTagCompound implements NBTBase {
@Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER
@Nullable @Nullable
public UUID a(String s) { public UUID a(String s) {
@ -23,3 +23,13 @@ index f608b35502890650adfc1df35e0794471f57ecbc..93b25e4580646ccfe8c671511e2250db
return GameProfileSerializer.a(this.get(s)); return GameProfileSerializer.a(this.get(s));
} }
public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER
public boolean b(String s) {
+ // Paper start - support old format
+ if (hasKey(s + "Least") && hasKey(s + "Most")) {
+ return true;
+ }
+ // Paper end
NBTBase nbtbase = this.get(s);
return nbtbase != null && nbtbase.b() == NBTTagIntArray.a && ((NBTTagIntArray) nbtbase).getInts().length == 4;