📗
Wiki
  • WIKI
  • Plugins
    • InfoHeads
      • Installation
      • FAQ
      • Using the Wizard
    • MailMe
      • Updating to MailMe Rewrite
      • FAQ
      • Setup
      • Tutorials
        • Niche
        • MailPresets
      • API
        • Setup
        • Interacting with the Database
  • Libraries
    • ProtectionAPI
      • Introduction
      • Getting Started
      • Tutorials
        • Creating a UniversalRegion
        • Collision Detection
      • Change Log
    • HexiTextLib
      • Introduction
      • Setup
        • Gradle
        • Maven
      • Using HexResolver
      • Using FontResolver
      • Change Log
Powered by GitBook
On this page
  • Valid Fonts:
  • Using Differing Fonts
  • Using Default Minecraft Fonts
  • Using Custom Fonts

Was this helpful?

  1. Libraries
  2. HexiTextLib

Using FontResolver

How to use the FontResolver to implement your custom fonts

PreviousUsing HexResolverNextChange Log

Last updated 4 years ago

Was this helpful?

Valid Fonts:

The following are all part of the enum MinecraftKeyFont

  • UNIFORM (Smaller, quirky font)

  • DEFAULT (Default chat text)

  • ALT (Enchanting Table)

Using Differing Fonts

Fonts can only be sent by using the thus, you will always get a BaseComponent or TextComponent returned.

Using Default Minecraft Fonts

Minecraft only comes with 3 fonts, as shown at the top of the page. When using the FontResolver, you must choose between these 3 to implement into your String. The first parameter is your string and the second parameter is the type of font defined in MinecraftKeyFont.

String text = "My Text in a new Font";
TextComponent component = FontResolver.parseFontString(text, MinecraftKeyFont.UNIFORM);

This can then be sent to the player via player.spigot().sendMessage(component);

Using Custom Fonts

You can also do a grab out of the client's resource pack language folder and use some custom fonts.

If the client does not have the font it can crash / kick the client. Only recommended if resource packs are enforced.

String text = "My Text in a new Font";
TextComponent component = FontResolver.parseFontString(text, "customfont");

These can also be passed a BaseComponent and its subclasses.

chat component api