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"
}
Retro Commands for b1.7.3
- it works on servers
- it has an extensible API.
- No dependencies required
Optional Dependencies
- To access /tp with dimensions, install STAPI
- To access /gamemode, install BHCreative
Help
- Use
/helpin-game
API
Note: Please make Retro Commands optional!!
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)
}
or build.gradle.kts if that's your tempo
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": "*"
},
in your mods initialization
public static void init_of_some_sort()
{
if (FabricLoader.getInstance().isModLoaded("retrocommands")){
MyModsCommands.add();
}
}
implement api.com.periut.retrocommands.Command
register with api.com.periut.retrocommands.CommandRegistry
CommandRegistry.add(new Command())
new Command() replaced with your custom command.
Add your own summon command for your entities
Use api.com.periut.retrocommands.SummonRegistry
SummonRegistry.add(...)
Examples from 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)} ");
Configuration
Cryonic Config is required for this feature.
This file generates when using a command for the first time
To disable commands go to {mc_dir}/config/retrocommands.json and in the json under "disabledCommands", set the value to commands you want to disable separated by commas
Examples:
{
"disabledCommands": "help,give,hat"
}
{
"disabledCommands": "hat"
}
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
下载 RetroCommands
Babric 与 Ornithe 发布
OSL 现已嵌入两个 JAR 文件中,因此 retrocommands 可在任一加载器上独立运行,无需单独安装 OSL。
在内部实现上,retrocommands 不再向其依赖模组导出任何依赖项——此前所有 OSL、cryonicconfig、starac 和 retroapi 均通过传递性泄漏。现在改为通过反射访问这些依赖模组。
完整更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧