Logo
MINECRAFTBIBLE
Items
Items

All game items

Blocks
Blocks

Building blocks

Mobs
Mobs

Creatures & monsters

Biomes
Biomes

World biomes

Structures
Structures

Generated structures

Recipes
Recipes

Crafting guides

Advancements
Advancements

Achievements

Loot Tables
Loot Tables

Drop rates

Tags
Tags

Item groupings

All Versions
View all data →
Capes
Cape ArchiveNEW

Browse rare Minecon capes, OptiFine capes, and custom capes from players worldwide

Browse

Player Database
Player DatabasePopular

Search any player

Skin Browser
Skin Browser

Browse & download skins

Cape Gallery
Cape GalleryNEW

Minecon & OptiFine capes

Seed Vault
Seed Vault

Curated seeds

Learn

Guides
GuidesNew

Tutorials & tips

Blog
Blog

News & updates

Community

Community Hub
Community HubHub

Posts, discussions & more

All Versions
View community →
Seed Analyzer
Seed Analyzer

World seed analysis

Loot Explorer
Loot Explorer

Drop rates

Crafting Calculator
Crafting Calculator

Material planning

Enchant Calculator
Enchant Calculator

Probability math

Redstone Lab
Redstone Lab

Signal timing

Trading Profit
Trading Profit

Villager ROI

All Versions
View all tools →
Mods
Mods

Browse all mods

Plugins
Plugins

Server plugins

Resource Packs
Resource Packs

Textures & sounds

Shaders
Shaders

Visual enhancements

Datapacks
Datapacks

World logic

Scanner
Mod Intelligence

Scan & analyze any mod

All Versions
View all mods →
Loading...
IntroductionIntroductionVersion HistoryVersion HistoryGuidesGuidesBlog & NewsBlog & News
ItemsItemsBlocksBlocksMobsMobsRecipesRecipesBiomesBiomesStructuresStructuresAdvancementsAdvancementsLoot TablesLoot TablesTagsTags
ModsModsPluginsPluginsResource PacksResource PacksShadersShadersDatapacksDatapacks

MinecraftBible

The Ultimate Wiki

Logo
MINECRAFTBIBLE

The ultimate Minecraft reference. Every item, block, mob, and recipe documented with precision.

Community

  • Player Database
  • Skin Browser
  • Cape Gallery
  • Community Hub
  • Seed Vault

Database

  • Items
  • Blocks
  • Mobs
  • Recipes
  • Biomes
  • Structures

Tools

  • Seed Analyzer
  • Mod Intelligence
  • Crafting Calculator
  • Enchant Calculator

Mods & Packs

  • Mods
  • Plugins
  • Resource Packs
  • Shaders
  • Datapacks

© 2026 MinecraftBible. Not affiliated with Mojang or Microsoft.

PrivacyTermsContact
Chat Message Library
ModMIT

Chat Message Library

A StringBuilder for Text, useful for commands and command-line tools.

371
Downloads
1
Followers
2 years ago
Updated
📦
2
Versions
librarymanagementutilityfabric
Download Latestv1.1View on Modrinth

📖About Chat Message Library

Deprecation Notice

I will no longer be actively supporting this mod, please use the Fabric and NeoForge Adventure API port, create your own implementation, or fork it on Github to continue using it.

Chat Message Library

I was annoyed that there was no java.lang.StringBuilder equivalent for net.minecraft.text.Text, so I decided to build my own.

For Users;

This is a library mod, and does not add anything to the game on its own.
Download the mod and drop it in your .minecraft/mods/ folder.
This mod also requires Fabric API to work.

For Developers;

To use the library, add this to your build.gradle, gradle.properties, and your mod's ModInitializer class respectively:

build.gradle:

repositories {
    maven { url = "https://api.modrinth.com/maven" }
}

dependencies {
    modApi include("maven.modrinth:chatmsglib:${project.cml_version}")
}

gradle.properties:

# This may be out of date!!
cml_version=1.1

Your ModInitializer:

public class YourMod implements ModInitializer {
    
    public static final ChatMessage CML = new ChatMessage();
    
    /*
    * This text is generated at startup and is held until server stop
    * To send it, use "msg::send", "msg.send(PlayerEntity)", or "msg.send(CommandContext)"
    * You can also modify it on the fly by adding more text
    */
    private static final ChatMessage msg = CML
            .header("This is always be displayed at the top of the message", Formatting.AQUA)
            .footer("This is always be displayed at the bottom of the message", Formatting.BOLD, Formatting.BLUE)
            .literal("Just a literal string, nothing special", Formatting.BLUE)
            .literal("Option for an \"on\" statement as well",
                    new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help"))
            .object(
                    // A List<Integer> turned into Text form
                    new IntList(yourInts)
                            // No spaces are added for Prefixes and Suffixes and must be added manually!
                            .prefix("What comes before the number is printed ")
                            .suffix(" What comes after the number is printed")
                            .create())
            .object(
                    // A JsonObject turned into Text form
                    new JsonList(yourJson)
                            .prefix("- ")
                            .indent(1)
                            .create()
            )
            .object(
                    // All text added to this object will display on the same line
                    new Singleton()
                            .add(Text.literal("Singletons are used to display text in one line only"))
                            .add(
                                    Text.literal("Also, commands in-line as well")
                                        .styled(style -> style.withClickEvent(
                                                new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help")
                                        ))
                            )
                            .create()
            )
            .object(
                    /*
                    * You can create your own lists by extending xyz.blurple.chatmsglib.list.ChatList
                    * It has to output List<Text>, everything else is your choice!
                    */
                    new YourList(yourInput)
                            .prefix("= ")
                            .create()
            );

    @Override
    public void onInitialize() {
        
        // This command simply prints out msg with the formatting you chose
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) ->
            dispatcher.register(
                CommandManager.literal("your_command")
                    .executes(msg::send)
            )
        );
    }
}

If you have a request or issue with the library, make an issue, and I'll take a shot at adding it.
Feel free to do anything you like with this code; fork, learn, whatever you like.

👥 Team & Contributors

GirlInPurple
GirlInPurpleOwner

⚙️ Compatibility

Environment
🖥️ Server-side
Loaders
fabric
Minecraft Versions
1.201.20.11.20.21.20.31.20.4

🔗 Links

Modrinth Page