Font

Represents a font inside of a resource pack, consisting of multiple font providers.

Constructors

Link copied to clipboard
constructor(key: Key)

Creates a font with the given key.

constructor()

Creates a font with the minecraft:default key.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var key: Key

The key of this font.

Link copied to clipboard
val providers: @UnmodifiableView List<FontProvider>

All font providers.

Functions

Link copied to clipboard
fun <P : FontProvider> addProvider(provider: P): P

Adds a new font provider.

Link copied to clipboard

Builds a bitmap font provider and adds it.

Link copied to clipboard
fun fallback(provider: (FontProvider) -> Key?)

Sets the asset fallback provider.

Link copied to clipboard
fun json(): String?

Serializes the font down to JSON, ready to export to a font file.

Link copied to clipboard

Builds a reference font provider and adds it.

Link copied to clipboard
open override fun save(pack: ResourcePack)

Saves this element to a resource pack.

Link copied to clipboard

Builds a space font provider and adds it.

Link copied to clipboard

Builds a TTF font provider and adds it.

Link copied to clipboard
open override fun validate(pack: ResourcePack): Result<Unit>

Validates this element and returns a Result of type Unit, with an optional exception extending ResourcePackValidationException. This API will probably be improved in the future.