Unruled API (未受限 API)
Unruled API 是一个拓展了原版游戏规则的模组,为其他模组提供了新的游戏规则类型。
![Unruled API (未受限 API)第1张-SODA Unruled API (未受限 API)](https://cdn.modrinth.com/data/pZ0PWFaa/images/74b5f15e18065a3b3e94dcc05f759b6feb241ca2.png)
Unruled API 允许创建新形式的游戏规则,超越了原版仅限的整数和布尔值。
尽管不会自动注册它们,但此模组允许您轻松创建新的浮点数、长整型、双精度、字符串、文本和枚举驱动的游戏规则,使用`mc.recraftors.unruled_api.UnruledApi` 类的生成静态方法。
为了一致性,还创建了方法以允许实例化原版游戏规则。
示例:
java
public void gamerulesRegistration() {
myGameRule = registerGamerule("my_gamerule", category, UnruledApi.createFloat(1.5));
myOtherGameRule = registerGamerule("my_other_gamerule", category, UnruledApi.createString("some text"));
myLastGameRule = registerGamerule("my_last_gamerule", category, UnruledApi.createBoolean(false, (server, rule) -> {
onLastRuleChange(server, rule);
}));
}
每个规则也可以使用`IGameRulesProvider` 接口轻松查询。
示例:
java
String value = ((IGameRulesProvider)gamerules).unruled_getString(myStringGameRule);
float aFloat = ((IGameRulesProvider)gamerules).unruled_getFloat(myFloatGameRule);
## 如何在您的项目中使用
您可以使用 Modrinth maven 在您的项目中实现此模组。不要犹豫阅读 [官方文档]( 链接)。
### 添加 Modrinth maven 仓库
groovy
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
### 导入模组
loom 示例:
groovy
dependencies {
// 使用 modApi 允许您的项目依赖项默认导入依赖项
modApi "maven.modrinth:unruled-api:${project.unruled_version}"
}
forgeGradle 示例:
groovy
dependencies {
implementation "maven.modrinth:unruled-api:${project.unruled_version}"
}
出于版权原因,我们要求您**不要**将此模组(JiJ、jar-in-a-jar、shadow 等)包含在您自己的内部。感谢您的理解。
截图:
来自Modrinth
Unruled API 0.4 - Fabric 1.20
# Release 0.4 for Fabric 1.20
Added convenience methods and new entity selector gamerule
展开
版本: 0.4-fabric+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 167
Unruled API 0.4 - Fabric 1.19
# Release 0.4 for Fabric 1.19
Added convenience methods and new entity selector gamerule
展开
版本: 0.4-fabric+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 36
Unruled API 0.4 - Forge 1.20
# Release 0.4 for Forge 1.20
Added convenience methods and new entity selector gamerule
展开
版本: 0.4-forge+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 136
Unruled API 0.4 - Forge 1.19
# Release 0.4 for Forge 1.19
Added convenience methods and new entity selector gamerule
展开
版本: 0.4-forge+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 57
Unruled API 0.3 - Forge 1.20
# Release 0.3 for Forge 1.20
Fix build to integrate access transformer
展开
版本: 0.3-forge+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 66
Unruled API 0.3 - Forge 1.19
# Release 0.3 for Forge 1.19
Fix build to integrate access transformer
展开
版本: 0.3-forge+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 35
Unruled API 0.3 - Forge 1.18
# Release 0.3 for Forge 1.18
Fix build to integrate access transformer
展开
版本: 0.3-forge+1.18
支持游戏: 1.18, 1.18.1, 1.18.2
Release
下载次数: 38
Unruled API 0.2 - Fabric 1.20
# Release 0.2 for Fabric 1.20
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-fabric+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 114
Unruled API 0.2 - Fabric 1.19
# Release 0.2 for Fabric 1.19
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-fabric+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 38
Unruled API 0.2 - Fabric 1.18
# Release 0.2 for Fabric 1.18
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-fabric+1.18
支持游戏: 1.18, 1.18.1, 1.18.2
Release
下载次数: 36
Unruled API 0.2 - Forge 1.20
# Release 0.2 for Forge 1.20
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-forge+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 41
Unruled API 0.2 - Forge 1.19
# Release 0.2 for Forge 1.19
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-forge+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 33
Unruled API 0.2 - Forge 1.18
# Release 0.2 for Forge 1.18
Fix build jar to be imported in Architectury Loom projects
展开
版本: 0.2-forge+1.18
支持游戏: 1.18, 1.18.1, 1.18.2
Release
下载次数: 30
Unruled API 0.1 - Fabric 1.20
## Release 0.1 for Fabric 1.20
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-fabric+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 36
Unruled API 0.1 - Fabric 1.19
## Release 0.1 for Fabric 1.19
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-fabric+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 41
Unruled API 0.1 - Fabric 1.18
## Release 0.1 for Fabric 1.18
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-fabric+1.18
支持游戏: 1.18, 1.18.1, 1.18.2
Release
下载次数: 36
Unruled API 0.1 - Forge 1.20
## Release 0.1 for Forge 1.20
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-forge+1.20
支持游戏: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
Release
下载次数: 34
Unruled API 0.1 - Forge 1.19
## Release 0.1 for Forge 1.19
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-forge+1.19
支持游戏: 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4
Release
下载次数: 31
Unruled API 0.1 - Forge 1.18
## Release 0.1 for Forge 1.18
Contains:
* Floating gamerules
* Long gamerules
* Double gamerules
* String gamerules
* Text gamerules
* Enum gamerules
Warning, there yet is no implementation for Text gamerules editing in the world creation menu.
展开
版本: 0.1-forge+1.18
支持游戏: 1.18, 1.18.1, 1.18.2
Release
下载次数: 31