|
1 | 1 | plugins {
|
2 |
| - id 'fabric-loom' version '1.2-SNAPSHOT' |
3 |
| - id 'com.matthewprenger.cursegradle' version '1.4.0' |
4 |
| - id 'com.github.johnrengelman.shadow' version '8.1.1' |
5 |
| - id 'com.modrinth.minotaur' version '2.+' |
6 |
| - id 'mod-update' version '2.0.0' |
| 2 | + id 'com.github.johnrengelman.shadow' version "${shadow_version}" |
| 3 | + id 'fabric-loom' version "${fabric_loom_version}" |
| 4 | + id 'mod-update' version "${mod_update_version}" |
| 5 | + id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" |
| 6 | + id 'com.modrinth.minotaur' version "${minotaur_version}" |
7 | 7 | }
|
8 | 8 |
|
9 |
| -sourceCompatibility = JavaVersion.VERSION_17 |
10 |
| -targetCompatibility = JavaVersion.VERSION_17 |
11 |
| - |
12 |
| -archivesBaseName = archives_base_name |
13 |
| -version = mod_version |
14 |
| -group = maven_group |
15 |
| - |
16 |
| -repositories { |
17 |
| - mavenLocal() |
18 |
| - mavenCentral() |
19 |
| - maven { url = 'https://maven.fabricmc.net/' } |
20 |
| - maven { url = 'https://maven.maxhenkel.de/repository/public'} |
21 |
| -} |
22 |
| - |
23 |
| -runClient.doFirst { |
24 |
| - args = ['--username', "henkelmax${new Random().nextInt(1000)}"] |
25 |
| -} |
26 |
| - |
27 |
| -dependencies { |
28 |
| - minecraft "com.mojang:minecraft:${minecraft_version}" |
29 |
| - mappings loom.officialMojangMappings() |
30 |
| - modImplementation "net.fabricmc:fabric-loader:${loader_version}" |
31 |
| - |
32 |
| - Set<String> apiModules = [ |
33 |
| - 'fabric-api-base', |
34 |
| - 'fabric-lifecycle-events-v1', |
35 |
| - 'fabric-networking-api-v1', |
36 |
| - 'fabric-resource-loader-v0', |
37 |
| - 'fabric-key-binding-api-v1' |
38 |
| - ] |
39 |
| - |
40 |
| - apiModules.forEach { |
41 |
| - include(modImplementation(fabricApi.module(it, fabric_version))) |
42 |
| - } |
43 |
| - |
44 |
| - implementation "de.maxhenkel.configbuilder:configbuilder:${configbuilder_version}" |
45 |
| - shadow "de.maxhenkel.configbuilder:configbuilder:${configbuilder_version}" |
46 |
| - |
47 |
| - implementation 'com.google.code.findbugs:jsr305:3.0.2' |
48 |
| -} |
| 9 | +apply from: "https://raw.githubusercontent.com/henkelmax/mod-gradle-scripts/${mod_gradle_script_version}/mod.gradle" |
49 | 10 |
|
50 | 11 | processResources {
|
51 | 12 | filesMatching('fabric.mod.json') {
|
52 |
| - expand 'version': version, |
| 13 | + expand 'mod_version': mod_version, |
53 | 14 | 'minecraft_dependency': minecraft_dependency,
|
54 |
| - 'loader_version': loader_version, |
55 |
| - 'min_fabric_version': fabric_version, |
| 15 | + 'fabric_loader_dependency': fabric_loader_dependency, |
| 16 | + 'fabric_api_dependency_breaks': fabric_api_dependency_breaks, |
56 | 17 | 'compatibility_version': mod_compatibility_version
|
57 | 18 | }
|
58 | 19 | }
|
59 |
| - |
60 |
| -tasks.withType(JavaCompile).configureEach { |
61 |
| - it.options.encoding = 'UTF-8' |
62 |
| - it.options.release = 17 |
63 |
| -} |
64 |
| - |
65 |
| -java { |
66 |
| - withSourcesJar() |
67 |
| -} |
68 |
| - |
69 |
| -jar { |
70 |
| - from('LICENSE') { |
71 |
| - rename { "${it}_${archivesBaseName}" } |
72 |
| - } |
73 |
| -} |
74 |
| - |
75 |
| -curseforge { |
76 |
| - apiKey = file('curseforge_api_key.txt').exists() ? file('curseforge_api_key.txt').text : '' |
77 |
| - project { |
78 |
| - id = curse_id |
79 |
| - changelogType = 'markdown' |
80 |
| - changelog = file('changelog.md') |
81 |
| - releaseType = release_type |
82 |
| - addGameVersion curseforge_minecraft_version |
83 |
| - addGameVersion 'Fabric' |
84 |
| - addGameVersion 'Java 17' |
85 |
| - mainArtifact(file("${buildDir}/libs/${archivesBaseName}-${version}.jar")) { |
86 |
| - displayName = "[FABRIC][${minecraft_version}] ${mod_name} ${mod_version}" |
87 |
| - relations { |
88 |
| - requiredDependency 'fabric-api' |
89 |
| - } |
90 |
| - } |
91 |
| - afterEvaluate { |
92 |
| - uploadTask.dependsOn(remapJar) |
93 |
| - } |
94 |
| - } |
95 |
| - options { |
96 |
| - forgeGradleIntegration = false |
97 |
| - } |
98 |
| -} |
99 |
| - |
100 |
| -tasks.modrinth.configure({ |
101 |
| - group = 'upload' |
102 |
| -}) |
103 |
| -tasks.modrinthSyncBody.configure({ |
104 |
| - group = 'upload' |
105 |
| -}) |
106 |
| - |
107 |
| -modrinth { |
108 |
| - token = file("${rootDir}/modrinth_token.txt").exists() ? file("${rootDir}/modrinth_token.txt").text : '' |
109 |
| - projectId = modrinth_id |
110 |
| - versionNumber = "fabric-${mod_version}" |
111 |
| - versionName = "[FABRIC][${minecraft_version}] ${mod_name} ${mod_version}" |
112 |
| - uploadFile = remapJar |
113 |
| - versionType = release_type.toUpperCase() |
114 |
| - changelog = file('changelog.md').text |
115 |
| - gameVersions = [minecraft_version] |
116 |
| - loaders = ['fabric'] |
117 |
| - dependencies { |
118 |
| - required.project 'P7dR8mSH' // Fabric API |
119 |
| - } |
120 |
| - syncBodyFrom = file("${rootDir}/readme.md").text |
121 |
| -} |
122 |
| -tasks.modrinth.dependsOn(build) |
123 |
| - |
124 |
| -modUpdate { |
125 |
| - serverURL = 'https://update.maxhenkel.de/' |
126 |
| - modID = mod_id |
127 |
| - gameVersion = minecraft_version |
128 |
| - modLoader = 'fabric' |
129 |
| - modVersion = mod_version |
130 |
| - changelogFile = file('changelog.md') |
131 |
| - releaseType = release_type |
132 |
| - tags = recommended == 'true' ? ['recommended'] : [] |
133 |
| -} |
134 |
| - |
135 |
| -shadowJar { |
136 |
| - configurations = [project.configurations.shadow] |
137 |
| - archiveClassifier = 'shadow-dev' |
138 |
| - relocate 'de.maxhenkel.configbuilder', "de.maxhenkel.${mod_id}.configbuilder" |
139 |
| -} |
140 |
| - |
141 |
| -remapJar { |
142 |
| - dependsOn shadowJar |
143 |
| - inputFile = shadowJar.archiveFile.get() |
144 |
| -} |
0 commit comments