-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to almost gradle plugin project setup
- Loading branch information
Showing
9 changed files
with
69 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,40 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
val license: String by project | ||
val loggingLevel: String by project | ||
val mixinDebugExport: String by project | ||
val recipeViewer: String by project | ||
val mcVersion: String by project | ||
val modVersion: String by project | ||
val modPackage: String by project | ||
val modId: String by project | ||
val modName: String by project | ||
val modAuthor: String by project | ||
val modDescription: String by project | ||
val neoVersion: String by project | ||
val parchmentVersion: String by project | ||
val aeVersion: String by project | ||
val jeiVersion: String by project | ||
val reiVersion: String by project | ||
val emiVersion: String by project | ||
val githubUser: String by project | ||
val githubRepo: String by project | ||
|
||
plugins { | ||
id("net.neoforged.moddev") version "2.0.+" | ||
id("com.github.gmazzo.buildconfig") version "4.0.4" | ||
java | ||
id("com.almostreliable.almostgradle") | ||
} | ||
|
||
base { | ||
version = "$mcVersion-$modVersion" | ||
group = modPackage | ||
archivesName.set("$modId-neoforge") | ||
almostgradle.setup { | ||
withSourcesJar = false | ||
recipeViewers.emi.mavenRepository | ||
} | ||
|
||
java.toolchain.languageVersion = JavaLanguageVersion.of(21) | ||
|
||
neoForge { | ||
version = neoVersion | ||
|
||
mods { | ||
create("merequester") { | ||
modSourceSets.add(sourceSets.main) | ||
} | ||
} | ||
|
||
runs { | ||
configureEach { | ||
gameDirectory = project.file("run") | ||
systemProperties = mapOf( | ||
"forge.logging.console.level" to loggingLevel, | ||
"mixin.debug.export" to mixinDebugExport, | ||
"guideDev.ae2guide.sources" to file("guidebook").absolutePath, | ||
"guideDev.ae2guide.sourcesNamespace" to modId | ||
"guideDev.ae2guide.sourcesNamespace" to almostgradle.modId | ||
) | ||
jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") | ||
} | ||
create("client") { | ||
client() | ||
programArguments.addAll("--quickPlaySingleplayer", "New World") | ||
} | ||
|
||
create("guide") { | ||
client() | ||
systemProperty("guideDev.ae2guide.startupPage", "$modId:$modId.md") | ||
systemProperty("guideDev.ae2guide.startupPage", "${almostgradle.modId}:${almostgradle.modId}.md") | ||
} | ||
create("server") { | ||
server() | ||
} | ||
} | ||
|
||
parchment { | ||
minecraftVersion = mcVersion | ||
mappingsVersion = parchmentVersion | ||
} | ||
} | ||
|
||
repositories { | ||
maven("https://modmaven.dev") // Applied Energistics 2 | ||
maven("https://maven.blamejared.com") // JEI | ||
maven("https://maven.shedaniel.me") // REI | ||
maven("https://maven.terraformersmc.com") // EMI | ||
maven("https://modmaven.dev") | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
implementation("appeng:appliedenergistics2:$aeVersion") | ||
|
||
when (recipeViewer) { | ||
"jei" -> runtimeOnly("mezz.jei:jei-$mcVersion-neoforge:$jeiVersion") { isTransitive = false } | ||
"rei" -> runtimeOnly("me.shedaniel:RoughlyEnoughItems-neoforge:$reiVersion") | ||
"emi" -> runtimeOnly("dev.emi:emi-neoforge:$emiVersion+$mcVersion") | ||
else -> throw GradleException("Invalid recipeViewer value: $recipeViewer") | ||
} | ||
implementation("appeng:appliedenergistics2:${almostgradle.getProperty("aeVersion")}") | ||
} | ||
|
||
tasks { | ||
processResources { | ||
val resourceTargets = listOf("META-INF/neoforge.mods.toml", "pack.mcmeta") | ||
|
||
val replaceProperties = mapOf( | ||
"license" to license, | ||
"mcVersion" to mcVersion, | ||
"version" to project.version as String, | ||
"modId" to modId, | ||
"modName" to modName, | ||
"modAuthor" to modAuthor, | ||
"modDescription" to modDescription, | ||
"neoVersion" to neoVersion, | ||
"aeVersion" to aeVersion, | ||
"githubUser" to githubUser, | ||
"githubRepo" to githubRepo | ||
) | ||
|
||
println("[Process Resources] Replacing properties in resources: ") | ||
replaceProperties.forEach { (key, value) -> println("\t -> $key = $value") } | ||
|
||
inputs.properties(replaceProperties) | ||
filesMatching(resourceTargets) { | ||
expand(replaceProperties) | ||
} | ||
tasks.withType<Jar> { | ||
from("guidebook") { | ||
into("assets/${almostgradle.modId}/ae2guide") | ||
} | ||
|
||
withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
withType<Jar> { | ||
from("guidebook") { | ||
into("assets/$modId/ae2guide") | ||
} | ||
} | ||
} | ||
|
||
buildConfig { | ||
buildConfigField("String", "MOD_ID", "\"$modId\"") | ||
buildConfigField("String", "MOD_NAME", "\"$modName\"") | ||
buildConfigField("String", "MOD_VERSION", "\"$version\"") | ||
packageName(modPackage) | ||
useJavaOutput() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
# Project | ||
license = GNU Lesser General Public License v3.0 | ||
loom.platform = neoforge | ||
|
||
# Settings | ||
loggingLevel = debug | ||
mixinDebugExport = false | ||
recipeViewer = emi | ||
|
||
# Minecraft | ||
mcVersion = 1.21 | ||
|
||
# Mod | ||
modVersion = 1.1.6 | ||
modPackage = com.almostreliable.merequester | ||
group = com.almostreliable | ||
modId = merequester | ||
modName = ME Requester | ||
modVersion = 1.1.6 | ||
minecraftVersion = 1.21.1 | ||
neoforgeVersion = 21.1.36 | ||
|
||
modAuthor = Almost Reliable | ||
modDescription = Keep items and fluids in your ME-System in stock. | ||
license = GNU Lesser General Public License v3.0 | ||
githubUser = AlmostReliable | ||
githubRepo = merequester | ||
|
||
# Project Dependencies | ||
neoVersion = 21.0.143 | ||
parchmentVersion = 2024.07.28 | ||
neoForge.parchment.minecraftVersion = 1.21 | ||
neoForge.parchment.mappingsVersion = 2024.07.28 | ||
|
||
# Mod Dependencies | ||
aeVersion = 19.0.18-beta | ||
jeiVersion = 19.5.2.66 | ||
reiVersion = 16.0.744 | ||
emiVersion = 1.1.10 | ||
|
||
# Github | ||
githubUser = AlmostReliable | ||
githubRepo = merequester | ||
# Settings | ||
almostgradle.buildconfig.name = ModConstants | ||
almostgradle.launchArgs.autoWorldJoin = true | ||
almostgradle.recipeViewers.emi.runConfig = true | ||
almostgradle.recipeViewers.emi.version = 1.1.12 | ||
almostgradle.recipeViewers.emi.minecraftVersion = 1.21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/main/java/com/almostreliable/merequester/MERequesterClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 19 additions & 13 deletions
32
src/main/java/com/almostreliable/merequester/Registration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters