message-api

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 0.3.5+26.1
本资源为搬运资源,原资源地址: https://modrinth.com/mod/message-api
资源信息

Minecraft 版本: 26.1 26.1.1 26.1.2

平台: fabric quilt

标签: library

资源介绍

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 ```java 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.

📥 下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
AsguhoServer

价格:0 墨喵币
下载量:0

查看详情
Lad's Skybox

价格:0 墨喵币
下载量:0

查看详情
Custom Elytra ResourcePack

价格:0 墨喵币
下载量:0

查看详情
JinxedLib

价格:0 墨喵币
下载量:0

查看详情