11buildscript {
22 repositories {
3- maven { url " https://maven.neoforged .net/releases " }
3+ maven { url = " https://maven.minecraftforge .net/" }
44 maven { url " https://plugins.gradle.org/m2/" }
5+ maven { url = ' https://repo.spongepowered.org/maven' }
56 mavenCentral()
67 }
7- dependencies {
8- classpath ' net.neoforged.moddev.legacyforge:net.neoforged.moddev.legacyforge. gradle.plugin:2.0.140 '
8+ dependencies {
9+ classpath group : ' net.minecraftforge. gradle' , name : ' ForgeGradle ' , version : ' 5.1.69 ' , changing : true
910 classpath " gradle.plugin.com.github.johnrengelman:shadow:7.1.0"
11+ classpath ' org.spongepowered:mixingradle:0.7-SNAPSHOT'
1012 }
1113}
1214
13- apply plugin : ' net.neoforged.moddev.legacyforge '
15+ apply plugin : ' net.minecraftforge.gradle '
1416// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
1517apply plugin : ' eclipse'
1618apply plugin : ' maven-publish'
1719apply plugin : ' com.github.johnrengelman.shadow'
20+ apply plugin : ' org.spongepowered.mixin'
1821
1922configurations {
2023 shade
@@ -43,37 +46,80 @@ version = "1.17.1-forge-" + umcVersion
4346group = " cam72cam.universalmodcore" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
4447archivesBaseName = " UniversalModCore"
4548
46- java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
49+ java. toolchain. languageVersion = JavaLanguageVersion . of(16 )
4750println (' Java: ' + System . getProperty(' java.version' ) + ' JVM: ' + System . getProperty(' java.vm.version' ) + ' (' + System . getProperty(' java.vendor' ) + ' ) Arch: ' + System . getProperty(' os.arch' ))
51+ minecraft {
52+ // The mappings can be changed at any time, and must be in the following format.
53+ // snapshot_YYYYMMDD Snapshot are built nightly.
54+ // stable_# Stables are built at the discretion of the MCP team.
55+ // Use non-default mappings at your own risk. they may not always work.
56+ // Simply re-run your setup task after changing the mappings to update your workspace.
57+ mappings channel : ' official' , version : ' 1.17.1'
58+ // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
59+
60+ accessTransformer = file(' src/main/resources/META-INF/accesstransformer.cfg' )
61+
62+ // Default run configurations.
63+ // These can be tweaked, removed, or duplicated as needed.
64+ runs {
65+ client {
66+ // Enable mixin-ed dependency in deobfuscated environment
67+ property(" mixin.env.remapRefMap" , " true" )
68+ property(" mixin.env.refMapRemappingFile" , " ${ projectDir} /build/createSrgToMcp/output.srg" )
4869
49- legacyForge {
50- version = " 1.17.1-37.1.1"
70+ workingDirectory project. file(' run' )
5171
52- accessTransformers. from " src/main/resources/META-INF/accesstransformer.cfg"
72+ // Recommended logging data for a userdev environment
73+ property ' forge.logging.markers' , ' REGISTRIES'
5374
54- // Validate AT files and raise errors when they have invalid targets
55- // This option is false by default, but turning it on is recommended
56- validateAccessTransformers = true
75+ // Recommended logging level for the console
76+ property ' forge.logging.console.level' , ' debug'
5777
58- runs {
59- client {
60- client()
78+ mods {
79+ universalmodcore {
80+ source sourceSets. main
81+ }
82+ }
6183 }
84+
6285 server {
63- server()
86+ // Enable mixin-ed dependency in deobfuscated environment
87+ property(" mixin.env.remapRefMap" , " true" )
88+ property(" mixin.env.refMapRemappingFile" , " ${ projectDir} /build/createSrgToMcp/output.srg" )
89+
90+ workingDirectory project. file(' run' )
91+
92+ // Recommended logging data for a userdev environment
93+ property ' forge.logging.markers' , ' REGISTRIES'
94+
95+ // Recommended logging level for the console
96+ property ' forge.logging.console.level' , ' debug'
97+
98+ mods {
99+ universalmodcore {
100+ source sourceSets. main
101+ }
102+ }
64103 }
104+
65105 data {
66- data()
67- }
68- }
106+ workingDirectory project. file(' run' )
107+
108+ // Recommended logging data for a userdev environment
109+ property ' forge.logging.markers' , ' REGISTRIES'
110+
111+ // Recommended logging level for the console
112+ property ' forge.logging.console.level' , ' debug'
69113
70- mods {
71- universalmodcore {
72- sourceSet sourceSets. main
114+ args ' --mod' , ' universalmodcore' , ' --all' , ' --output' , file(' src/generated/resources/' )
115+
116+ mods {
117+ universalmodcore {
118+ source sourceSets. main
119+ }
120+ }
73121 }
74122 }
75-
76- addModdingDependenciesTo(sourceSets. test)
77123}
78124
79125repositories {
@@ -87,11 +133,12 @@ repositories {
87133}
88134
89135dependencies {
136+ minecraft ' net.minecraftforge:forge:1.17.1-37.1.1'
90137 // you may put jars on which you depend on in ./libs
91138 // or you may define them like so..
92139 // compile "some.group:artifact:version:classifier"
93140 // compile "some.group:artifact:version"
94-
141+
95142 // real examples
96143 // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
97144 // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
@@ -107,36 +154,39 @@ dependencies {
107154 // for more info...
108155 // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
109156 // http://www.gradle.org/docs/current/userguide/dependency_management.html
110- annotationProcessor(' org.spongepowered:mixin:0.8.5 :processor' )
111- additionalRuntimeClasspath (annotationProcessor(shade(' io.github.llamalad7:mixinextras-common:0.5.0' )))
157+ annotationProcessor(' org.spongepowered:mixin:0.8.3 :processor' )
158+ minecraftLibrary (annotationProcessor(shade(' io.github.llamalad7:mixinextras-common:0.5.0' )))
112159
113- testImplementation (' junit:junit:4.13' )
114- testImplementation ' org.junit.jupiter:junit-jupiter:5.7.2'
115- testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
160+ // testImplementation ('junit:junit:4.13')
161+ testImplementation group : ' org.junit.jupiter' , name : ' junit-jupiter-api' , version : ' 5.7.2'
116162
117- additionalRuntimeClasspath (shade group : ' javax.vecmath' , name : ' vecmath' , version : ' 1.5.2' )
118- additionalRuntimeClasspath (shade group : ' at.yawk.lz4' , name : ' lz4-java' , version : ' 1.10.2' )
163+ minecraftLibrary (shade group : ' javax.vecmath' , name : ' vecmath' , version : ' 1.5.2' )
164+ minecraftLibrary (shade group : ' at.yawk.lz4' , name : ' lz4-java' , version : ' 1.10.2' )
119165}
120166
121167mixin {
122168 add sourceSets. main, ' mixins.universalmodcore.refmap.json'
123169
124170 config ' mixins.feat.universalmodcore.json'
125171 config ' mixins.fix.universalmodcore.json'
172+
173+ // Dev environment setup
174+ debug. verbose = true
175+ debug. export = true
176+ dumpTargetOnFailure = true
126177}
127178
128179jar {
129180 archiveClassifier = ' slim'
130181 manifest {
131182 attributes([
132- " Specification-Title" : " universalmodcore" ,
133- " Specification-Vendor" : " " ,
134- " Specification-Version" : " 1" , // We are version 1 of ourselves
135- " Implementation-Title" : project. name,
136- " Implementation-Version" : umcVersion,
137- " Implementation-Vendor" :" " ,
138- " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" ),
139- " MixinConfigs" : " mixins.feat.universalmodcore.json,mixins.fix.universalmodcore.json"
183+ " Specification-Title" : " universalmodcore" ,
184+ " Specification-Vendor" : " " ,
185+ " Specification-Version" : " 1" , // We are version 1 of ourselves
186+ " Implementation-Title" : project. name,
187+ " Implementation-Version" : umcVersion,
188+ " Implementation-Vendor" :" " ,
189+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
140190 ])
141191 }
142192}
@@ -158,14 +208,12 @@ shadowJar {
158208
159209assemble. dependsOn shadowJar
160210
161- obfuscation {
162- // Reobfuscate the shadowJar task, using the classpath of the main sourceset for properly remapping inherited members
163- // This will place the original shadow jar in build/devlibs while putting this reobfuscated version in build/libs
164- reobfuscate(tasks. named(' shadowJar' ), sourceSets. main)
211+ reobf {
212+ shadowJar {}
165213}
166214
167215test {
168- useJUnitPlatform ()
216+ useJUnit ()
169217 maxHeapSize = ' 1G'
170218}
171219
0 commit comments