Support old UUID format for NBT
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.
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
--- a/net/minecraft/world/item/component/ResolvableProfile.java
|
||||
+++ b/net/minecraft/world/item/component/ResolvableProfile.java
|
||||
@@ -49,7 +49,7 @@
|
||||
@@ -20,9 +20,10 @@
|
||||
instance -> instance.group(
|
||||
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
|
||||
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
|
||||
+ UUIDUtil.STRING_CODEC.lenientOptionalFieldOf("Id").forGetter($ -> Optional.empty()), // Paper
|
||||
ExtraCodecs.PROPERTY_MAP.optionalFieldOf("properties", new PropertyMap()).forGetter(ResolvableProfile::properties)
|
||||
)
|
||||
- .apply(instance, ResolvableProfile::new)
|
||||
+ .apply(instance, (s, uuid, uuid2, propertyMap) -> new ResolvableProfile(s, uuid2.or(() -> uuid), propertyMap)) // Paper
|
||||
);
|
||||
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
|
||||
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
|
||||
@@ -49,7 +50,7 @@
|
||||
if (this.isResolved()) {
|
||||
return CompletableFuture.completedFuture(this);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user