Experimental Feature
Minecraft serializers allow for element-specific serialization/deserialization of individual resource pack components (e.g., fonts, languages) rather than the whole pack.
Note: This feature is experimental and may change significantly in future major releases.
Deserializing a font
Use FontSerializer.INSTANCE.deserialize with a Readable.resource to load a font from the classpath.
Serializing a language
Use LanguageSerializer.INSTANCE.serialize to write a Language object to an OutputStream.
// Deserializing a font
Font font = FontSerializer.INSTANCE.deserialize(
Readable.resource(getClass().getClassLoader(), "font.json"),
Key.key("custom:fontkey")
);
// Serializing a language
Language language = ...;
try (OutputStream output = new FileOutputStream("es.json")) {
LanguageSerializer.INSTANCE.serialize(language, output);
}