文本占位符 API(Neoforge 版)

文本占位符 API(Neoforge 版)

在文本中设置占位符值,并随意操作它们。

基础库

这是 Text Placeholder API 的 Neoforge 移植版。该库可让你在使用 Minecraft 的组件(Component)和翻译(Translation)系统时更轻松地操作文本和值:例如,根据场景将文本替换为变化或切换的文本。

提醒一下,这是一个模组,本身不会做任何事情——它为其他模组作者提供了可供使用的工具。

原版模组请见此处

面向开发者

设置你的项目 将 Modrinth 添加到你的仓库(repositories)块中。

maven {
    name = "Modrinth"
    url = "https://api.modrinth.com/maven"
}

然后添加依赖。


dependencies {
    implementation "maven.modrinth:tpan:3.0.0+26.1"
}

neoforge.mods.toml 中将其添加为依赖项。由于 Neoforge 不支持下划线,模组 ID 为 placeholderapi

[[dependencies.${mod_id}]]
modId = "placeholderapi"
type = "required"
versionRange = "[3.0.0+26.1,]"
ordering = "NONE"
side = "BOTH"

与原版项目一样,你也可以随意 JIJ(Jar-in-Jar)这个模组。