|
TLA Api (TLA Api)Github |相关wiki |源站链接支持: fabric , quiltTLA api是一个用于Minecraft的配方查看器API的抽象层。
允许mod开发人员编写他们的配方查看器集成一次,然后在多个配方查看器上运行。
目前支持的配方查看器包括:[EMI](链接)和[REI](链接)。
用法
#### Gradle
TLA api可以在jitpack上使用。将以下内容添加到您的build.gradle文件中以使用它:
groovy
repositories {
maven {
url \"https://jitpack.io\"
}
}
dependencies {
modImplementation \"com.github.mattidragon:TlaApi:${tla_api_version}\"
include \"com.github.mattidragon:TlaApi:${tla_api_version}\"
}
#### 入口点
要使用API,您需要实现`TlaApiPlugin`接口,并将您的实现添加到`tla-api`入口点。
请注意,整个API仅在客户端使用。 如果您使用拆分源集,则需要在客户端源集中实现API。
java
public class MyTlaPlugin implements TlaApiPlugin {
@Override
public void register(PluginContext context) {
// 在这里注册您的API
}
}
json
{
\"entrypoints\": {
\"tla-api\": [
\"my.package.MyTlaPlugin\"
]
}
}
#### 注册内容
设置入口点后,您可以开始注册内容。
整个API都使用JavaDocs进行了文档化,因此您可以使用您的IDE来探索API。
API设计主要基于EMIs,但我不得不做一些更改以适应REI。
#### 需要考虑的事情
尽管TLA api对所有东西进行了抽象,但您仍然需要自行验证您的代码是否与两个配方查看器都兼容。
例如,您仍然需要翻译所有EMI的标签。 一些小部件可能会以略有不同的方式渲染。
在使用API时要寻找的一个有用的内容是以下注解。
它们有助于解释API的使用方式。
- `@ApiStatus.Internal`:这意味着这部分代码不适合被mod开发者使用。
- `@ImplementationOnly`:这意味着这部分代码仅适用于配方查看器的实现。
除非您正在创建自己的配方查看器集成,否则不应该使用API的这部分内容。
- `@PluginOnly`:这意味着这部分代码仅适用于插件,而不适用于配方查看器的实现。
- `@ImplementationsExtend`:这表示接口由API的实现进行实现,而插件通常不应该实现它。
- `@PluginsExtend`:这表示接口由插件进行实现,而API的实现通常不应该实现它。
问题
#### Q: 这是否允许仅支持一个查看器的mod在两者上运行?
A: 不允许。此API只是让mod开发者更容易支持两个查看器。
#### Q: 为什么这个API仅限于客户端?
A: EMI的整个API只能在客户端使用。REI有一个服务器端API,但它不包含TLA使用的任何功能。
#### Q: 是否有任何示例?
A: 是的,您可以在这里找到测试mod [here](链接)。它可能做了一些您通常不会做的事情,但通常很好地展示了API的功能。
来自Modrinth所有游戏版本1.211.21.11.20.61.20.4所有类型fabricquiltv1.2.1 [1.21]TLA-Api-1.2.1.jar下载1.2.1+mc.1.21#ReleaseTLA-Api-1.2.1-sources.jar下载1.2.1+mc.1.21#Release* Add support for custom item comparisons* Fix recipes using custom widgets not working outside of dev展开版本: 1.2.1+mc.1.21支持游戏: 1.21类型:FabricQuiltRelease下载次数: 82v1.2.0 [1.21]TLA-Api-1.2.0.jar下载1.2.0+mc.1.21#ReleaseTLA-Api-1.2.0-sources.jar下载1.2.0+mc.1.21#Release* Updated to 1.21 (thanks [@Sollace](https://github.com/Sollace))* Added JEI support展开版本: 1.2.0+mc.1.21支持游戏: 1.21, 1.21.1类型:FabricQuiltRelease下载次数: 488v1.1.1 [1.20.6]TLA-Api-1.1.1.jar下载1.1.1+mc.1.20.6#ReleaseTLA-Api-1.1.1-sources.jar下载1.1.1+mc.1.20.6#Release* Fixed jitpack release展开版本: 1.1.1+mc.1.20.6支持游戏: 1.20.6类型:FabricQuiltRelease下载次数: 178v1.1.0 [1.20.6]TLA-Api-1.1.0.jar下载1.1.0+mc.1.20.6#ReleaseTLA-Api-1.1.0-sources.jar下载1.1.0+mc.1.20.6#Release* Updated to 1.20.6* Added support for click areas (REI only)* Added the ability to get the active recipe viewer展开版本: 1.1.0+mc.1.20.6支持游戏: 1.20.6类型:FabricQuiltRelease下载次数: 120v1.0.1 [1.20.4]TLA-Api-1.0.1.jar下载1.0.1+mc.1.20.4#ReleaseTLA-Api-1.0.1-sources.jar下载1.0.1+mc.1.20.4#Release* Added `TlaStack#asIngredient` utility method* Added the ability to register workstations* Added the ability to create dark mode versions of textures* Reworked how texture configs are built (old methods deprecated)* Added option for custom widgets to utilize the dark theme* Added support for custom animated textures* Fixed issue where texture category icons weren\'t converted correctly for emi* Improved testmod展开版本: 1.0.1+mc.1.20.4支持游戏: 1.20.4类型:FabricQuiltRelease下载次数: 150v1.0.0 [1.20.4]TLA-Api-1.0.0.jar下载1.0.0+mc.1.20.4#ReleaseTLA-Api-1.0.0-sources.jar下载1.0.0+mc.1.20.4#ReleaseFirst release展开版本: 1.0.0+mc.1.20.4支持游戏: 1.20.4类型:FabricQuiltRelease下载次数: 135全部版本
markdown_parsed
文章类型:收录
layui.use([\'form\'], function(){
var form = layui.form;
});
TLA Api |
楼主
2025-8-10 19:40:50
回复(0)
收起回复
|