提供HoverEvent.Action的注册
注册后可实现
- 成书中使用
- /tellraw的Json模式生成
maven {
name "kituinMavenReleases"
url "https://maven.kituin.fun/releases"
}
modImplementation("io.github.kituin:ActionLib:{action_lib_version}")
mc | ActionLib | loader |
---|---|---|
1.16.5-1.20.2 | 0.6.3-fabric | Fabric |
1.20.3/1.20.4 | 1.0.2-fabric | Fabric |
1.20.5+ | 1.1.1-fabric | Fabric |
1.16.5 | 0.6.4-forge | Forge |
1.17-1.20.2 | 0.9.4-fabric | Forge |
1.20.3/1.20.4 | 1.0.4-forge | Forge |
1.20.6+ | 1.2.2-forge | Forge |
1.20.2 | 1.6.1-neoforge | NeoForge |
1.20.3/1.20.4 | 1.9.2-neoforge | NeoForge |
1.20.5+ | 1.10.1-neoforge | NeoForge |
当然你也可以添加include
进行jarInJar
新建类继承IActionRegisterApi
public class ActionLibIntegration implements IActionRegisterApi {
@Override
public List<HoverEvent.Action> registerHoverEventAction() {
return List.of(SHOW_IMAGE);
}
}
SHOW_IMAGE
为你定义的HoverEvent.Action
,模组ChatImage
中的HoverEvent.Action示例
在fabric.mod.json
中新增你的类
"entrypoints": {
"client": [
"github.kituin.chatimage.client.ChatImageClient"
],
"main": [
"github.kituin.chatimage.ChatImage"
],
"modmenu": [
"github.kituin.chatimage.integration.ModmenuIntegration"
],
+ "actionlib": ["github.kituin.chatimage.integration.ActionLibIntegration"]
},
新建类继承IActionRegisterApi
,并使用注解@AlPlugin
@AlPlugin
public class ActionLibIntegration implements IActionRegisterApi {
@Override
public List<HoverEvent.Action> registerHoverEventAction() {
return List.of(SHOW_IMAGE);
}
}
SHOW_IMAGE
为你定义的HoverEvent.Action
,模组ChatImage
中的HoverEvent.Action示例
新建类继承IActionRegisterApi
,并使用注解@AlPlugin
@AlPlugin
public class ActionLibIntegration implements IActionRegisterApi {
@Override
public List<HoverEvent.Action> registerHoverEventAction() {
return List.of(SHOW_IMAGE);
}
}
SHOW_IMAGE
为你定义的HoverEvent.Action
,模组ChatImage
中的HoverEvent.Action示例