Add missing TagSerializable to GsonDataComponentValue converter (Fixes #11768)

This commit is contained in:
Shane Freeder 2025-01-17 13:46:59 +00:00
parent b1b88cd316
commit 938a84fc39
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -76,6 +76,20 @@ public class DataComponentValueConverterProviderImpl implements DataComponentVal
throw new IllegalArgumentException(e);
}
}
),
DataComponentValueConverterRegistry.Conversion.convert(
DataComponentValue.TagSerializable.class,
GsonDataComponentValue.class,
(key, tagSerializable) -> {
Tag decodedSnbt;
try {
decodedSnbt = tagSerializable.asBinaryTag().get(PaperAdventure.NBT_CODEC);
} catch (CommandSyntaxException e) {
throw new IllegalArgumentException("Unable to parse SNBT value", e);
}
return GsonDataComponentValue.gsonDataComponentValue(NbtOps.INSTANCE.convertTo(JsonOps.INSTANCE, decodedSnbt));
}
)
);
}