|
1 | 1 | //BUILDSCRIPT// |
2 | | -buildscript { |
3 | | - repositories { |
4 | | - maven { url = "https://maven.minecraftforge.net/" } |
5 | | - mavenCentral() |
6 | | - } |
7 | | - dependencies { |
8 | | - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.69', changing: true |
9 | | - } |
| 2 | +plugins { |
| 3 | + id 'java' |
| 4 | + id 'eclipse' |
| 5 | + //A customized fork for better support on Cleanroom |
| 6 | + id 'xyz.wagyourtail.unimined' version "1.4.18-kappa" |
| 7 | + id 'com.gradleup.shadow' version "9.4.1" |
| 8 | + id "maven-publish" |
| 9 | + id 'xyz.wagyourtail.jvmdowngrader' version '1.3.6' |
| 10 | +} |
| 11 | +configurations { |
| 12 | + umcShade |
| 13 | + modImplementation.extendsFrom umcShade |
10 | 14 | } |
11 | 15 |
|
12 | 16 | //PLUGINS// |
13 | | -apply plugin: 'net.minecraftforge.gradle' |
14 | | -apply plugin: 'eclipse' |
15 | 17 |
|
16 | 18 | //MINECRAFT// |
17 | | -sourceSets { |
18 | | - main { |
19 | | - resources { |
20 | | - srcDirs = [ |
21 | | - "$rootDir/src/main/resources", |
22 | | - "$rootDir/src/generated/resources" |
23 | | - ] |
24 | | - } |
| 19 | +java { |
| 20 | + toolchain { |
| 21 | + languageVersion = JavaLanguageVersion.of(25) |
25 | 22 | } |
| 23 | + |
| 24 | + withSourcesJar() |
| 25 | +} |
| 26 | + |
| 27 | +tasks.withType(JavaCompile).configureEach { |
| 28 | + options.release = 25 |
26 | 29 | } |
27 | | -java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
28 | | - |
29 | | -minecraft { |
30 | | - mappings channel: 'official', version: '1.20.1' |
31 | | - runs { |
32 | | - client { |
33 | | - workingDirectory project.file('run') |
34 | | - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' |
35 | | - property 'forge.logging.console.level', 'debug' |
36 | | - mods { |
37 | | - #ID# { |
38 | | - source sourceSets.main |
39 | | - } |
40 | | - } |
41 | | - } |
42 | | - |
43 | | - server { |
44 | | - workingDirectory project.file('run') |
45 | | - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' |
46 | | - property 'forge.logging.console.level', 'debug' |
47 | | - mods { |
48 | | - #ID# { |
49 | | - source sourceSets.main |
50 | | - } |
51 | | - } |
52 | | - } |
53 | | - |
54 | | - data { |
55 | | - workingDirectory project.file('run') |
56 | | - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' |
57 | | - property 'forge.logging.console.level', 'debug' |
58 | | - args '--mod', '#ID#', '--all', '--output', file('src/generated/resources/') |
59 | | - mods { |
60 | | - #ID# { |
61 | | - source sourceSets.main |
62 | | - } |
63 | | - } |
64 | | - } |
| 30 | + |
| 31 | +jvmdg { |
| 32 | + quiet = false |
| 33 | + downgradeTo = JavaVersion.VERSION_1_8 |
| 34 | + multiReleaseOriginal = true |
| 35 | + shadeInlining = false |
| 36 | + dg(configurations.umcShade, false) |
| 37 | + //MR-JAR uses a Incremental Update-like strategy, so add versions here won't cause too much waste |
| 38 | + multiReleaseVersions = [ |
| 39 | + JavaVersion.VERSION_1_8, // 1.16 and below |
| 40 | + JavaVersion.VERSION_16, // 1.17 |
| 41 | + JavaVersion.VERSION_17, // 1.18 - 1.20 |
| 42 | + JavaVersion.VERSION_21, // 1.21 |
| 43 | + JavaVersion.VERSION_25 // 26.1 and beyond as well as modern 1.7.10/1.12.2 |
| 44 | + ].toSet() |
| 45 | +} |
| 46 | + |
| 47 | +unimined.minecraft { |
| 48 | + version "1.20.1" |
| 49 | + |
| 50 | + mappings { |
| 51 | + mojmap() |
| 52 | + parchment("1.20.1", "2023.09.03") |
| 53 | + } |
| 54 | + |
| 55 | + minecraftForge { |
| 56 | + loader("47.4.20") |
65 | 57 | } |
| 58 | + |
| 59 | + defaultRemapJar = true |
66 | 60 | } |
67 | 61 |
|
68 | 62 | //DEPENDENCIES// |
69 | 63 | #UMC_REPO# |
70 | 64 |
|
71 | 65 | dependencies { |
72 | | - minecraft 'net.minecraftforge:forge:1.20.1-47.1.46' |
73 | 66 | implementation group: 'javax.vecmath', name: 'vecmath', version: '1.5.2' |
74 | | -// No need in FG3+ |
75 | | -// runtime "net.minecrell:terminalconsoleappender:1.3.0" |
76 | | - implementation fg.deobf(#UMC_DEPENDENCY#) |
| 67 | + modImplementation #UMC_DEPENDENCY# |
77 | 68 | } |
78 | 69 |
|
79 | 70 | //JAR// |
80 | 71 | jar { |
81 | | - manifest { |
82 | | - attributes([ |
83 | | - "Specification-Title": "#ID#", |
84 | | - "Specification-Vendor": "#ID#", |
85 | | - "Specification-Version": "1", // We are version 1 of ourselves |
86 | | - "Implementation-Title": project.name, |
87 | | - "Implementation-Version": "${version}", |
88 | | - "Implementation-Vendor" :"#ID#", |
89 | | - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") |
90 | | - ]) |
91 | | - } |
| 72 | + enabled = false |
92 | 73 | } |
93 | | -jar.finalizedBy('reobfJar') |
94 | 74 |
|
95 | | -tasks.withType(JavaCompile).configureEach { |
96 | | - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation |
| 75 | +shadowJar { |
| 76 | + configurations = [project.configurations.umcShade] |
| 77 | + duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| 78 | + mergeServiceFiles() |
| 79 | + archiveClassifier = 'shadow' |
| 80 | +} |
| 81 | + |
| 82 | +remapJar { |
| 83 | + inputFile = tasks.shadeDowngradedApi.archiveFile |
| 84 | + dependsOn(tasks.named("shadowJar")) |
| 85 | + archiveClassifier = '' |
| 86 | +} |
| 87 | + |
| 88 | +tasks.named("assemble") { |
| 89 | + dependsOn(tasks.named("remapJar")) |
| 90 | +} |
| 91 | + |
| 92 | +processResources { |
| 93 | + duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| 94 | + inputs.property "version", project.version |
| 95 | + inputs.property "mcversion", "#MINECRAFT#" |
| 96 | + from(sourceSets.main.resources.srcDirs) { |
| 97 | + include 'mcmod.info' |
| 98 | + expand 'version':project.version, 'mcversion':"#MINECRAFT#" |
| 99 | + } |
| 100 | + from(sourceSets.main.resources.srcDirs) { |
| 101 | + exclude 'mcmod.info' |
| 102 | + } |
97 | 103 | } |
0 commit comments