Retro Commands for b1.7.3
- 适用于服务器
- 提供可扩展的 API。
- 无需依赖
可选依赖项
- 若要使用带有维度参数的
/tp命令,请安装 STAPI - 若要使用
/gamemode命令,请安装 BHCreative
帮助
- 在游戏中使用
/help
API
注意:请将 Retro Commands 设为可选依赖!!
build.gradle
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
dependencies {
def retroCommandsJar = configurations.detachedConfiguration(
dependencies.create("maven.modrinth:retrocommands:${project.properties['retrocommands_version']}")
)
retroCommandsJar.transitive = false
modLocalRuntime files(zipTree(retroCommandsJar.singleFile).matching { include 'META-INF/jars/*.jar' }.files)
}
或者如果你的项目使用 build.gradle.kts:
repositories {
exclusiveContent {
forRepository {
maven("https://api.modrinth.com/maven")
}
filter {
includeGroup("maven.modrinth")
}
}
}
dependencies {
val retroCommandsJar = configurations.detachedConfiguration(
dependencies.create("maven.modrinth:retrocommands:${project.properties["retrocommands_version"]}")
).apply { isTransitive = false }
modLocalRuntime(files(zipTree(retroCommandsJar.singleFile).matching { include("META-INF/jars/*.jar") }.files))
}
}
fabric.mod.json
"suggests": {
"retrocommands": "*"
},
在你的模组初始化代码中:
public static void init_of_some_sort()
{
if (FabricLoader.getInstance().isModLoaded("retrocommands")){
MyModsCommands.add();
}
}
实现 api.com.periut.retrocommands.Command
通过 api.com.periut.retrocommands.CommandRegistry 进行注册
CommandRegistry.add(new Command())
将 new Command() 替换为你的自定义命令。
为你的实体添加自定义召唤命令
使用 api.com.periut.retrocommands.SummonRegistry
SummonRegistry.add(...)
参考 util.com.periut.retrocommands.VanillaMobs 中的示例:
SummonRegistry.add(Creeper.class, (world, pos, param) -> {
Creeper creeper = new Creeper(world);
if (param.length > 5)
if (!param[5].isEmpty())
if (param[5].charAt(0) != '0')
((EntityAccessor) creeper).getDataTracker().setInt(17, (byte) 1);
return creeper;
}, "{charged (0 or 1)}");
SummonRegistry.add(Sheep.class, (world, pos, param) -> {
int color = Integer.parseInt(param[5]);
int has_wool = 1;
if (param.length > 6)
has_wool = Integer.parseInt(param[6]);
Sheep sheep = new Sheep(world);
sheep.setSheared(has_wool == 0);
sheep.setColour(color);
return sheep;
}, "{wool color meta} {has wool (0/1)} ");
配置
Cryonic Config 是此功能的必要依赖。
首次使用相关命令时会自动生成此文件
若要禁用命令,请前往 {mc_dir}/config/retrocommands.json,在 JSON 文件的 "disabledCommands" 字段下,设置为你想要禁用的命令名称(以逗号分隔)。
示例:
{
"disabledCommands": "help,give,hat"
}
{
"disabledCommands": "hat"
}
你是这个资源的作者?登录后可认领此资源。
相似资源
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
查看物品与配方
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
AE2:一款流行的自动化与存储模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧