HomeJavaModsmessage-api
ModsJava

message-api

by DrexHD · on Modrinth

Which build do you need?

This mod ships a separate file for every mod loader and every version of the game. Pick both, then download — the wrong build installs fine and then does nothing in the game.

Mod loader

Minecraft version

⬇ Download for 26.1–26.1.2 · Fabric⬇ Download for 1.21.11 · Fabric⬇ Download for 1.21.9–1.21.10 · Fabric⬇ Download for 1.21.8 · Fabric⬇ Download for 1.21.5–1.21.7 · Fabric⬇ Download for 1.21.4 · Fabric⬇ Download for 1.21.2–1.21.3 · Fabric⬇ Download for 1.21.1 · Fabric⬇ Download for 1.21 · Fabric⬇ Download for 26.1–26.1.2 · Quilt⬇ Download for 1.21.11 · Quilt⬇ Download for 1.21.9–1.21.10 · Quilt⬇ Download for 1.21.8 · Quilt⬇ Download for 1.21.5–1.21.7 · Quilt⬇ Download for 1.21.4 · Quilt⬇ Download for 1.21.2–1.21.3 · Quilt⬇ Download for 1.21.1 · Quilt⬇ Download for 1.21 · Quilt
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.

message-api

A simple server-side message API for Fabric. It allows for translatable messages, with text parsing using PlaceholderAPI , which can be customized with ease by end users.

Features

Usage

Adding the dependency

To use message-api in your mod, add the following to your build.gradle file:

Message-api doesn't bundle placeholder-api, you have to bundle a compatible of it as well. Replace [TAG] with the respective versions.

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

dependencies {
    include(modImplementation("maven.modrinth:message-api:[TAG]"))
    include(modImplementation("eu.pb4:placeholder-api:[TAG]"))
}

Adding messages

Create a messages folder in your resource folder. Create a JSON file with the language code you would like to add, like the testmod example. Add your message to the file (make sure to prefix the message id with your mod id, to avoid conflicts).

Creating messages

Use any of the provided methods in LocalizedMessage to get your text instance, which works like any other vanilla text instance!

ServerPlayerEntity player;
player.sendMessageToClient(LocalizedMessage.localized("modid.some.message.id"));
Official Mojang Mappings
ServerPlayer player;
player.sendSystemMessage(LocalizedMessage.localized("modid.some.message.id"));

User configuration

To change messages, edit the JSON file in ./config/<modid>/<languageid>.json. This will change the language file for the mod with the specified modid.

Credits

Special thanks to PlaceholderAPI for providing the parsing functionality.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more