RetroCommands

模组

· 作者 Slainlight

Retro Commands 基于 Fabric 构建,适用于 b1.7.3,同时也支持多人游戏,并提供 API。

0 本站下载 0 关注 更新于 3 个月前

最新 0.7.5+babric · Babric

一键开服(送7天)

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"
}

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源