Fix hoverEvent translation from 1.20.2 to 1.20.3 in some cases (#3591)

This commit is contained in:
Jerry Xiao 2023-12-22 19:10:29 +08:00 committed by GitHub
parent 18f2cf25cd
commit 0e31664bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,17 +193,18 @@ public final class ComponentConverter {
// Store show_entity id as int array instead of uuid string // Store show_entity id as int array instead of uuid string
// Not really required, but we might as well make it more compact // Not really required, but we might as well make it more compact
final JsonObject hoverEvent = value.getAsJsonObject(); final JsonObject hoverEvent = value.getAsJsonObject();
final CompoundTag convertedTag = (CompoundTag) convertToTag(value);
final JsonElement id = hoverEvent.get("id"); final JsonElement id = hoverEvent.get("id");
final UUID uuid; final UUID uuid;
if (id != null && id.isJsonPrimitive() && (uuid = UUIDUtil.parseUUID(id.getAsString())) != null) { if (id != null && id.isJsonPrimitive() && (uuid = UUIDUtil.parseUUID(id.getAsString())) != null) {
hoverEvent.remove("id"); convertedTag.remove("id");
final CompoundTag convertedTag = (CompoundTag) convertToTag(value);
convertedTag.put("id", new IntArrayTag(UUIDUtil.toIntArray(uuid))); convertedTag.put("id", new IntArrayTag(UUIDUtil.toIntArray(uuid)));
}
tag.put(key, convertedTag); tag.put(key, convertedTag);
return; return;
} }
}
tag.put(key, convertToTag(value)); tag.put(key, convertToTag(value));
} }