Generate example
Generate a small starter Nows mod project.
Generated Gradle files use https://files.nows.space/maven/. The Nows plugin applies Java, prepares Minecraft and adds the normal compile-only classpath.
settings.gradle.kts
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://repo.spongepowered.org/repository/maven-public/")
maven("https://files.nows.space/maven/")
}
}
rootProject.name = "my_mod"gradle.properties
org.gradle.jvmargs=-Xmx2G -Dfile.encoding=UTF-8
org.gradle.parallel=true
minecraft_version=26.2
nows_version=0.10.0
mod_id=my_mod
mod_name=My Mod
mod_version=1.0.0
mod_description=My Mod generated starter mod.
mod_author=
mod_license=Apache-2.0
mod_icon=
mod_homepage=
mod_sources=
mod_issues=
build.gradle.kts
plugins {
id("space.nows.gradle") version "0.10.0"
}
group = "com.example.mymod"
version = providers.gradleProperty("mod_version").get()
repositories {
mavenCentral()
maven("https://repo.spongepowered.org/repository/maven-public/")
maven("https://files.nows.space/maven/")
}
nows {
minecraftVersion.set(providers.gradleProperty("minecraft_version"))
nowsVersion.set(providers.gradleProperty("nows_version"))
modId.set(providers.gradleProperty("mod_id"))
modName.set(providers.gradleProperty("mod_name"))
}
dependencies {
compileOnly("org.jetbrains:annotations:26.0.2")
}
README.md
# My Mod
Generated Nows mod project.
Open this folder in IntelliJ IDEA, Eclipse Buildship, VS Code Gradle, or any IDE that can import a Gradle project.
The Nows Gradle plugin reads `gradle.properties`, adds the Minecraft/Nows development classpath, and prepares the
matching Mojang-named client jar on first sync/build.
## Build
```bash
gradle build
```
This builds `build/libs/my_mod-<mod_version>.jar` for Minecraft 26.2 / Nows 0.10.0.
## Install And Run
Install the Nows launcher profile for Minecraft 26.2 / Nows 0.10.0, then run:
```bash
gradle installMod
```
`installMod` copies `build/libs/my_mod-<mod_version>.jar` to the default Minecraft
`mods` folder. To target another folder:
```bash
gradle installMod -Pminecraft_mods_dir=/path/to/.minecraft/mods
```
Open the Nows profile in the Minecraft Launcher and start the game.
src/main/resources/nows.mod.kdl
mod id="${modId}" name="${modName}" version="${modVersion}" minecraft="${minecraftVersion}" side="client" {
info {
description "${modDescription}"
author "${modAuthor}"
license "${modLicense}"
icon "${modIcon}"
}
links {
homepage "${modHomepage}"
sources "${modSources}"
issues "${modIssues}"
}
compatibility {
requires "minecraft" version="${minecraftVersion}"
requires "nows" version="${nowsVersion}"
}
runtime {
entrypoint "com.example.mymod.MyMod"
mixin "my_mod.mixins.json"
listener "com.example.mymod.MyModLifecycleListener"
}
}src/main/resources/assets/my_mod/lang/en_us.json
{
"itemGroup.my_mod.main": "My Mod",
"screen.my_mod.config": "My Mod Settings",
"option.my_mod.enabled": "Enabled",
"option.my_mod.cooldown": "Cooldown"
}
src/main/resources/my_mod.mixins.json
{
"required": false,
"package": "com.example.mymod.mixin",
"compatibilityLevel": "JAVA_25",
"mixins": [],
"client": []
}
src/main/java/com/example/mymod/MyMod.java
package com.example.mymod;
import reactor.util.Logger;
import space.nows.platform.api.ModInitializer;
import space.nows.platform.api.NowsContext;
import space.nows.integration.logging.NowsLog;
public final class MyMod implements ModInitializer {
private static final Logger LOG = NowsLog.get(MyMod.class);
@Override
public void onInitialize(NowsContext context) {
LOG.info("My Mod loaded on {} with {} mod(s).",
context.side().metadataName(), context.mods().size());
}
}src/main/java/com/example/mymod/MyModLifecycleListener.java
package com.example.mymod;
import reactor.util.Logger;
import space.nows.integration.geb.NowsLifecycleListener;
import space.nows.integration.geb.event.NowsEntrypointsCompletedEvent;
import space.nows.integration.logging.NowsLog;
public final class MyModLifecycleListener implements NowsLifecycleListener {
private static final Logger LOG = NowsLog.get(MyModLifecycleListener.class);
@Override
public void onNowsEntrypointsCompleted(NowsEntrypointsCompletedEvent event) {
LOG.info("My Mod observed {} entrypoint(s).", event.count());
}
}.gitignore
.gradle/
build/
out/
*.iml