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.