All Mods Resource Packs Data Packs Shaders Modpacks Plugins
M

message-api

by DrexHD • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

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

  • Special text parsing with PlaceholderAPI
  • Easy customizable in-game messages
  • Language localization support
  • Easy to integrate

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.

How to Install message-api (Mod)

message-api by DrexHD is verified for Fabric, Quilt across Minecraft versions 1.21, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.3, 1.21.4, 1.21.5 (latest release: 0.3.5+26.1, file size: 31 KB). Follow the steps below to install it safely from ModCraft.tv:

  1. Click the Download button above and select your Minecraft version (1.21, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.3, 1.21.4, 1.21.5) and platform (Fabric, Quilt).
  2. Make sure you have the compatible loader or environment installed for Fabric, Quilt.
  3. Move the downloaded message-api file into your Minecraft .minecraft/mods folder and launch the game.

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
26.1.x
Fabric Quilt
8mo ago 1
1.21.11
Fabric Quilt
10mo ago 1
1.21.8
Fabric Quilt
10mo ago 1
1.21.4
Fabric Quilt
10mo ago 1
1.21.1
Fabric Quilt
10mo ago 1
1.21.x
Fabric Quilt
last yr. 1
1.21.8
Fabric Quilt
last yr. 1
1.21.4
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.1
Fabric Quilt
last yr. 1
1.21.4
Fabric Quilt
last yr. 1
1.21.x
Fabric Quilt
last yr. 1
1.21.x
Fabric Quilt
last yr. 1
1.21.x
Fabric Quilt
last yr. 1
1.21.x
Fabric Quilt
last yr. 1
Download message-api
Select game version
Select platform