message-api
Fabric message api for translatable, configurable and colorful messages with placeholders
介绍
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.
常见问题
message-api 支持哪些 Minecraft 版本?
message-api 支持 Minecraft Java 版 1.21–26.1.2,共 15 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。
message-api 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅服务端。
DrexHD 的其他作品
查看全部 →CrashExploitFixer
这个模组修复了在Minecraft中发现的许多崩溃漏洞。
VillagerConfig
基于数据驱动交易的高级村民配置
quick pack
优化数据包/资源包 zip 文件的加载时间
Ledger
一款服务端日志记录模组
评论
登录后评论和评分