[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-20 23:13:41 +01:00
parent e34d100c9c
commit dee90322eb
43 changed files with 134 additions and 137 deletions

View file

@ -15,12 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void putUUID(String key, UUID value) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ this.tags.remove(key + "Most");
+ this.tags.remove(key + "Least");
+ }
+ // Paper end
+ // Paper end - Support old UUID format
this.tags.put(key, NbtUtils.createUUID(value));
}
@ -28,20 +28,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE.
*/
public UUID getUUID(String key) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (!contains(key, 11) && this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ return new UUID(this.getLong(key + "Most"), this.getLong(key + "Least"));
+ }
+ // Paper end
+ // Paper end - Support old UUID format
return NbtUtils.loadUUID(this.get(key));
}
public boolean hasUUID(String key) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ return true;
+ }
+ // Paper end
+ // Paper end - Support old UUID format
Tag tag = this.get(key);
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
}
@ -53,14 +53,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable
public static GameProfile readGameProfile(CompoundTag nbt) {
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
+ // Paper start - Support string UUIDs
+ // Paper start - Support old UUID format
+ if (nbt.contains("Id", Tag.TAG_STRING)) {
+ try {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ } catch (IllegalArgumentException ignored){
+ }
+ }
+ // Paper end - Support string UUIDs
+ // Paper end - Support old UUID format
String string = nbt.getString("Name");
try {