13
0
geforkt von Mirrors/Paper

readd old UUID format patch

Dieser Commit ist enthalten in:
Jake Potrebic 2024-04-26 17:41:36 -07:00
Ursprung a9b6792b11
Commit f0911d4f2d

Datei anzeigen

@ -45,22 +45,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Tag tag = this.get(key); Tag tag = this.get(key);
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4; return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
} }
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java diff --git a/src/main/java/net/minecraft/world/item/component/ResolvableProfile.java b/src/main/java/net/minecraft/world/item/component/ResolvableProfile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java --- a/src/main/java/net/minecraft/world/item/component/ResolvableProfile.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/world/item/component/ResolvableProfile.java
@@ -0,0 +0,0 @@ public final class NbtUtils { @@ -0,0 +0,0 @@ public record ResolvableProfile(Optional<String> name, Optional<UUID> id, Proper
@Nullable instance -> instance.group(
public static GameProfile readGameProfile(CompoundTag nbt) { ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID; UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
+ // Paper start - Support old UUID format + UUIDUtil.STRING_CODEC.lenientOptionalFieldOf("Id").forGetter($ -> Optional.empty()), // Paper
+ if (nbt.contains("Id", Tag.TAG_STRING)) { ExtraCodecs.PROPERTY_MAP.optionalFieldOf("properties", new PropertyMap()).forGetter(ResolvableProfile::properties)
+ try { )
+ uUID = UUID.fromString(nbt.getString("Id")); - .apply(instance, ResolvableProfile::new)
+ } catch (IllegalArgumentException ignored){ + .apply(instance, (s, uuid, uuid2, propertyMap) -> new ResolvableProfile(s, uuid2.or(() -> uuid), propertyMap)) // Paper
+ } );
+ } public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
+ // Paper end - Support old UUID format FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
String string = nbt.getString("Name");
try {