mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-16 01:15:08 +01:00
- fix: NullPointerException when the config class of mod updated
- alter: better test code in `common/src/test`, `neoforge/src/test` and `fabric/src/test`, run `Test Minecraft Client(:fabric)` or `Test Minecraft Client(:neoforge)` for testing
This commit is contained in:
@@ -13,11 +13,44 @@ repositories {
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
neoForge {
|
||||
platformPackage = "neoforge"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
compileClasspath += main.compileClasspath
|
||||
runtimeClasspath += main.runtimeClasspath
|
||||
java {
|
||||
srcDirs.add('src/test/java' as File)
|
||||
}
|
||||
resources {
|
||||
srcDirs.add('src/test/resources' as File)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
|
||||
runs {
|
||||
testClient {
|
||||
client()
|
||||
name = "Test Minecraft Client"
|
||||
|
||||
mods {
|
||||
create('midnightlib') {
|
||||
sourceSet sourceSets.main
|
||||
}
|
||||
create('modid') { // test mod
|
||||
sourceSet sourceSets.test
|
||||
}
|
||||
}
|
||||
source sourceSets.test
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -44,6 +77,10 @@ dependencies {
|
||||
|
||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
||||
|
||||
// testImplementation common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||
testImplementation common(project(path: ':common', configuration: 'testOutput')) { transitive false }
|
||||
testImplementation sourceSets.main.output
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -54,6 +91,14 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
processTestResources {
|
||||
inputs.property 'version', rootProject.version
|
||||
|
||||
filesMatching('META-INF/neoforge.mods.toml') {
|
||||
expand version: rootProject.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = 'dev-shadow'
|
||||
@@ -105,4 +150,4 @@ unifiedPublishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package eu.midnightdust.test.neoforge;
|
||||
|
||||
import eu.midnightdust.test.config.MidnightConfigExample;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
||||
@Mod(MLExampleNeoForge.MODID)
|
||||
public class MLExampleNeoForge {
|
||||
public static final String MODID = "modid";
|
||||
public MLExampleNeoForge() {
|
||||
MidnightConfigExample.init(MODID, MidnightConfigExample.class);
|
||||
}
|
||||
}
|
||||
34
neoforge/src/test/resources/META-INF/neoforge.mods.toml
Normal file
34
neoforge/src/test/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,34 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "modid"
|
||||
version = "${version}"
|
||||
displayName = "MidnightLib Test Mod"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Example Mod for Team MidnightDust's mods.
|
||||
'''
|
||||
|
||||
[[dependencies.modid]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.modid]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.modid]]
|
||||
modId = "midnightlib"
|
||||
mandatory = true
|
||||
versionRange = "[1.0,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
Reference in New Issue
Block a user