Minecraft gameplay modifications for server admins who know Java
| gradle/wrapper | ||
| src/main | ||
| .gitignore | ||
| build.gradle | ||
| gradle.properties | ||
| LICENSE.txt | ||
| README.md | ||
| settings.gradle | ||
| todo.md | ||
Nema
A module loader for Fabric servers, with an explicit focus on hot-reloading. Designed for a server admin who wants to add custom gameplay elements to their server and knows Java, but hates restarting the server constantly. (me)
Module Development
Create a Gradle project with Minecraft and the Yarn mappings as dependencies (Fabric API not required for modules).
Your build.gradle should have this in it:
repositories {
maven { url "https://git.sulfrix.com/api/packages/Sulfrix/maven" }
}
dependencies {
// To change the versions use the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "com.sulfrix:nema:+"
}
Create a class that extends NemaModule:
public class TestModule extends NemaModule {
public static TestModule instance;
@Override
public void load() {
// Initialize your module, add any event handlers and schedules
RegisterEvents(new Events());
instance = this;
}
@Override
public void unload() {
// Undo any modifications made to game state, if needed
}
}
Event Listening
Events work in a similar way to Bukket/Spigot/Paper. Create a class that extends EventListener and use the @EventHandler annotation on methods.
public class Events extends EventListener {
@EventHandler
public void OnDamage(DamageEvent event) {
// Do something when an entity takes damage
}
}
Be sure to register your events class in your module's load() method. Event listeners are unloaded automatically when the module unloads.