Unruled API
Expands on the vanilla gamerules to add new gamerules types for other mods to use
介绍
Unruled API
(for some reason CurseForge doesn’t like to properly render the boxed url or code blocks, along other aspects, sorry about that. Don’t hesitate to head on to the Modrinth page to see the proper and colored version)
—
Allows to create new form of gamerules, beyond the restrictive vanilla integers and booleans.
Albeit not registering them automatically, this mod allows you to easily create new floating, long, double, string, text and enum-driven gamerules, using the generative static methods of the mc.recraftors.unruled_api.UnruledApi class.
For consistency, methods have also been created to allow instantiating vanilla gamerules.
Example:
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);
}));
}
Each rule can also be easily consulted using the IGameRulesProvider interface.
Example:
String value = ((IGameRulesProvider)gamerules).unruled_getString(myStringGameRule);
float aFloat = ((IGameRulesProvider)gamerules).unruled_getFloat(myFloatGameRule);
How to use in your project
You can implement this mod in your project using the Modrinth maven.
Don’t hesitate to read the official documentation.
Need help
Don’t hesitate to join our Discord!
Add the Modrinth maven repository
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
<br /><br />
Import the mod
loom example:
dependencies {
// using modApi allows your project's dependents to also import dependencies by default
modApi "maven.modrinth:unruled-api:${project.unruled_version}"
}
forgeGradle example:
dependencies {
implementation "maven.modrinth:unruled-api:${project.unruled_version}"
}
For copyright reasons, we require you to not include (JiJ, jar-in-a-jar, shadow, etc) this mod inside of your own. Thank you for your comprehension.
常见问题
Unruled API 支持哪些 Minecraft 版本?
Unruled API 支持 Minecraft Java 版 1.18–1.20.4,共 13 个版本,可用的加载器:Fabric / Forge / NeoForge / Quilt。下载时注意选择和你游戏版本一致的文件。
Unruled API 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Forge / NeoForge / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
评论
登录后评论和评分