11@file:Suppress(" SpellCheckingInspection" )
22
3+ import org.slf4j.event.Level
34import java.text.SimpleDateFormat
45import java.util.*
56
7+ val modId: String = " simplehoney"
8+
69var envVersion: String = System .getenv(" VERSION" ) ? : " 9.9.9"
710if (envVersion.startsWith(" v" ))
811 envVersion = envVersion.trimStart(' v' )
912
10- val modId: String = property(" mod_id" ) as String
11- val isRelease: Boolean = (System .getenv(" RELEASE" ) ? : " false" ).equals(" true" , true )
12-
1313plugins {
14+ java
1415 id(" idea" )
1516 id(" eclipse" )
1617 id(" maven-publish" )
17- id(" java-library" )
18- // alias(neoforged.plugins.moddev)
19- id(" net.neoforged.gradle.userdev" ) version (" 7.0.119" )
18+ alias(neoforged.plugins.moddev)
2019}
2120
2221base {
23- archivesName.set(modId )
22+ archivesName.set(" simplehoney " )
2423 group = " dev.compactmods.simplehoney"
2524 version = envVersion
2625}
2726
2827java {
28+ toolchain.vendor.set(JvmVendorSpec .JETBRAINS )
2929 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
3030}
3131
@@ -50,56 +50,82 @@ sourceSets.test {
5050 }
5151}
5252
53- minecraft {
54- modIdentifier.set(modId)
55- // accessTransformers.file(project.file("src/main/resources/META-INF/accesstransformer.cfg"))
56- }
53+ neoForge {
54+ version = neoforged.versions.neoforge.get()
55+
56+ val mainMod = this .mods.create(modId) {
57+ modSourceSets.add(sourceSets.main)
58+
59+ if (System .getenv().containsKey(" CI" )) {
60+ modSourceSets.add(sourceSets.test)
61+ }
62+ }
63+
64+ unitTest {
65+ enable()
66+ testedMod = mods.named(modId)
67+ }
5768
58- runs {
59- // applies to all the run configs below
60- configureEach {
61- // Recommended logging data for a userdev environment
62- systemProperty( " forge.logging.markers " , " " ) // 'SCAN,REGISTRIES,REGISTRYDUMP'
69+ parchment {
70+ enabled = true
71+ mappingsVersion = libs.versions.parchment
72+ minecraftVersion = libs.versions.parchmentMC
73+ }
6374
64- // Recommended logging level for the console
65- systemProperty(" forge.logging.console.level" , " debug" )
75+ runs {
76+ // applies to all the run configs below
77+ configureEach {
78+ logLevel.set(Level .DEBUG )
79+ sourceSet = project.sourceSets.main
6680
67- if (! System .getenv().containsKey(" CI" )) {
6881 // JetBrains Runtime Hotswap
69- // jvmArgument("-XX:+AllowEnhancedClassRedefinition")
82+ if (! System .getenv().containsKey(" CI" )) {
83+ jvmArgument(" -XX:+AllowEnhancedClassRedefinition" )
84+ }
85+
86+ systemProperties.put(" terminal.ansi" , " true" )
7087 }
7188
72- modSource(sourceSets.main.get())
73- }
89+ create(" client" ) {
90+ client()
91+ gameDirectory.set(file(" runs/client" ))
7492
75- create(" client" ) {
76- // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
77- systemProperty(" forge.enabledGameTestNamespaces" , modId)
93+ // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
94+ systemProperty(" forge.enabledGameTestNamespaces" , modId)
7895
79- programArguments(" --username" , " Nano" )
80- programArguments(" --width" , " 1920" )
81- programArguments(" --height" , " 1080" )
82- }
96+ programArguments.addAll (" --username" , " Nano" )
97+ programArguments.addAll (" --width" , " 1920" )
98+ programArguments.addAll (" --height" , " 1080" )
99+ }
83100
84- create(" server" ) {
85- systemProperty(" forge.enabledGameTestNamespaces" , modId)
86- environmentVariables(" TEST_RESOURCES" , project.file(" src/test/resources" ).path)
87- modSource(project.sourceSets.test.get())
88- }
101+ create(" client2" ) {
102+ client()
103+ gameDirectory.set(file(" runs/client" ))
89104
90- create( " data " ) {
91- dataGenerator( true )
105+ // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
106+ systemProperty( " forge.enabledGameTestNamespaces " , modId )
92107
93- programArguments(" --mod" , modId)
94- programArguments(" --all" )
95- programArguments(" --output" , file(" src/generated/resources" ).absolutePath)
96- programArguments(" --existing" , file(" src/main/resources" ).absolutePath)
97- }
108+ programArguments.addAll(" --username" , " Nano2" )
109+ programArguments.addAll(" --width" , " 1920" )
110+ programArguments.addAll(" --height" , " 1080" )
111+ }
98112
99- create(" gameTestServer" ) {
100- systemProperty(" forge.enabledGameTestNamespaces" , modId)
101- environmentVariable(" TEST_RESOURCES" , file(" src/test/resources" ).path)
102- modSource(project.sourceSets.test.get())
113+ this .create(" data" ) {
114+ this .data()
115+
116+ this .gameDirectory.set(file(" runs/data" ))
117+
118+ programArguments.addAll(" --mod" , modId)
119+ programArguments.addAll(" --all" )
120+ programArguments.addAll(" --output" , file(" src/generated/resources" ).absolutePath)
121+ programArguments.addAll(" --existing" , file(" src/main/resources" ).absolutePath)
122+ }
123+
124+ create(" server" ) {
125+ server()
126+ gameDirectory.set(file(" runs/server" ))
127+ programArgument(" nogui" )
128+ }
103129 }
104130}
105131
@@ -124,8 +150,7 @@ repositories {
124150}
125151
126152dependencies {
127- // implementation(neoforged.neoforge)
128- implementation(" net.neoforged" , " neoforge" , " 21.0.143" )
153+
129154}
130155
131156tasks.withType<ProcessResources > {
0 commit comments