mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
readd old UUID format patch
This commit is contained in:
parent
a9b6792b11
commit
f0911d4f2d
@ -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 {
|
|
Loading…
Reference in New Issue
Block a user