Chat Message Library

⭐ — (1 endorsements) 📥 469 downloads 📌 v1.1 📅 2/12/2024
⚪ Last updated 2024

By GirlInPurple · fabric

⬇ Download Mod Source: Modrinth ↗ 📅 Updated: 2/15/2024 📅 Created: 2/12/2024
⚠️ Install Order · 2 steps
1🛠️ Forge — Minecraft Forge (mod loader) Download ↗
2🛠️ Fabric — Fabric Loader Download ↗

Install in this order, then this mod last — most mods fail to load without their framework and dependencies in place.

🔍 Analysis

  • 🏆 #24 of 907 fabric mods in this game by downloads

📋 About This Mod

# Deprecation Notice I will no longer be actively supporting this mod, please use the (https://docs.advntr.dev/platform/modded.html), create your own implementation, or fork it on Github to continue using it. # Chat Message Library I was annoyed that there was no (https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html) 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 (https://modrinth.com/mod/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`: ```groovy repositories { maven { url = "https://api.modrinth.com/maven" } } dependencies { modApi include("maven.modrinth:chatmsglib:${project.cml_version}") } ``` `gradle.properties`: ```properties # This may be out of date!! cml_version=1.1 ``` Your `ModInitializer`: ```java 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.

# Deprecation Notice I will no longer be actively supporting this mod, please use the (https://docs.advntr.dev/platform/modded.html), 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`](https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html) 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 (https://modrinth.com/mod/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`: ```groovy repositories { maven { url = "https://api.modrinth.com/maven" } }

dependencies { modApi include("maven.modrinth:chatmsglib:${project.cml_version}") } ``` `gradle.properties`: ```properties # This may be out of date!! cml_version=1. 1 ``` Your `ModInitializer`: ```java 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 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, 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.

🤖 AI-enhanced — based on mod data

📊 Mod Details

Game
Minecraft Mods
Author
GirlInPurple
Version
1.1
Downloads
469
Endorsements
1
Category
fabric
Created
2/12/2024
Updated
2/15/2024
Game Versions
1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Tags
library, management, utility

🔧 How to Install Minecraft Mods Mods

Download from Modrinth. Use Prism Launcher or drop into your mods folder.

📖 Full step-by-step install guide for Minecraft Mods →

Visit the official mod page for specific installation instructions for this mod.

🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Mods commands, item IDs, and more.

❓ Frequently Asked Questions

Which Minecraft Mods versions does Chat Message Library support?

The author lists 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4. Other versions may work but are untested by the author.

What is the latest version of Chat Message Library?

Version 1.1, published 2024-02-15 with 469 downloads recorded at the source.

Keep browsing — more Minecraft Mods mods await

📋 All Minecraft Mods Mods 🏆 Top 25 📂 More fabric 👤 More by GirlInPurple 🔎 Similar Mods 🌐 Best fabric (All Games) 🔀 Check Compatibility ⚖️ Compare Mods 🆕 New Mods