|
1 |
| -buildscript { |
2 |
| - repositories { |
3 |
| - maven { url = 'https://files.minecraftforge.net/maven' } |
4 |
| -// jcenter() |
5 |
| - mavenCentral() |
6 |
| - } |
7 |
| - dependencies { |
8 |
| - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1+', changing: true |
9 |
| - } |
10 |
| -} |
11 | 1 | plugins {
|
| 2 | + id 'java-library' |
12 | 3 | id 'eclipse'
|
| 4 | + id 'idea' |
13 | 5 | id 'maven-publish'
|
| 6 | + id 'net.neoforged.gradle.userdev' version '7.0.57' |
14 | 7 | }
|
15 |
| -apply plugin: 'net.minecraftforge.gradle' |
16 |
| -//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. |
17 |
| - |
18 |
| -version = "${project.mc_version}-${project.mod_version}" |
19 |
| -group = "${project.maven_group}" |
20 |
| -archivesBaseName = "${project.mod_id}" |
21 |
| - |
22 |
| -java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
23 |
| -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) |
24 |
| - |
25 |
| -minecraft { |
26 |
| - mappings channel: 'official', version: "${project.mc_version}" |
27 |
| - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') |
28 |
| - |
29 |
| - runs { |
30 |
| - client { |
31 |
| - workingDirectory project.file('run') |
32 |
| - property 'forge.logging.markers', 'SCAN,REGISTRIES' |
33 |
| - property 'forge.logging.console.level', 'debug' |
34 |
| - |
35 |
| - property 'forge.enabledGameTestNamespaces', 'rebornstorage' |
36 |
| - |
37 |
| - //Patchouli |
38 |
| - property 'mixin.env.remapRefMap', 'true' |
39 |
| - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" |
40 |
| - |
41 |
| - mods { |
42 |
| - rebornstorage { |
43 |
| - source sourceSets.main |
44 |
| - } |
45 |
| - } |
46 |
| - } |
47 |
| - |
48 |
| - server { |
49 |
| - workingDirectory project.file('run') |
50 |
| - property 'forge.logging.markers', 'SCAN,REGISTRIES' |
51 |
| - property 'forge.logging.console.level', 'debug' |
52 | 8 |
|
53 |
| - property 'forge.enabledGameTestNamespaces', 'rebornstorage' |
54 |
| - |
55 |
| - //Patchouli |
56 |
| - property 'mixin.env.remapRefMap', 'true' |
57 |
| - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" |
58 |
| - |
59 |
| - mods { |
60 |
| - rebornstorage { |
61 |
| - source sourceSets.main |
62 |
| - } |
63 |
| - } |
64 |
| - } |
| 9 | +def ENV = System.getenv() |
65 | 10 |
|
66 |
| - gameTestServer { |
67 |
| - workingDirectory project.file('run') |
| 11 | +version = minecraft_version + "-" + mod_version + "-neoforge" |
| 12 | +group = mod_group_id |
68 | 13 |
|
69 |
| - // Recommended logging data for a userdev environment |
70 |
| - // The markers can be added/remove as needed separated by commas. |
71 |
| - // "SCAN": For mods scan. |
72 |
| - // "REGISTRIES": For firing of registry events. |
73 |
| - // "REGISTRYDUMP": For getting the contents of all registries. |
74 |
| - property 'forge.logging.markers', 'REGISTRIES' |
| 14 | +repositories { |
| 15 | + mavenLocal() |
| 16 | +} |
75 | 17 |
|
76 |
| - // Recommended logging level for the console |
77 |
| - // You can set various levels here. |
78 |
| - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels |
79 |
| - property 'forge.logging.console.level', 'debug' |
| 18 | +base { |
| 19 | + archivesName = mod_id |
| 20 | +} |
80 | 21 |
|
81 |
| - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. |
82 |
| - property 'forge.enabledGameTestNamespaces', 'rebornstorage' |
| 22 | +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. |
| 23 | +java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
83 | 24 |
|
84 |
| - mods { |
85 |
| - rebornstorage { |
86 |
| - source sourceSets.main |
87 |
| - } |
88 |
| - } |
89 |
| - } |
| 25 | +//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') |
| 26 | +minecraft { |
| 27 | + accessTransformers { |
| 28 | + file('src/main/resources/META-INF/accesstransformer.cfg') |
| 29 | + } |
| 30 | +} |
90 | 31 |
|
91 |
| - data { |
92 |
| - workingDirectory project.file('run') |
| 32 | +// Default run configurations. |
| 33 | +// These can be tweaked, removed, or duplicated as needed. |
| 34 | +runs { |
| 35 | + // applies to all the run configs below |
| 36 | + configureEach { |
| 37 | + // Recommended logging data for a userdev environment |
| 38 | + // The markers can be added/remove as needed separated by commas. |
| 39 | + // "SCAN": For mods scan. |
| 40 | + // "REGISTRIES": For firing of registry events. |
| 41 | + // "REGISTRYDUMP": For getting the contents of all registries. |
| 42 | + systemProperty 'forge.logging.markers', 'REGISTRIES' |
| 43 | + |
| 44 | + // Recommended logging level for the console |
| 45 | + // You can set various levels here. |
| 46 | + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels |
| 47 | + systemProperty 'forge.logging.console.level', 'debug' |
| 48 | + |
| 49 | + modSource project.sourceSets.main |
| 50 | + } |
93 | 51 |
|
94 |
| - property 'forge.logging.markers', 'REGISTRIES' |
| 52 | + client { |
| 53 | + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. |
| 54 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 55 | + } |
95 | 56 |
|
96 |
| - property 'forge.logging.console.level', 'debug' |
| 57 | + server { |
| 58 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 59 | + programArgument '--nogui' |
| 60 | + } |
97 | 61 |
|
98 |
| - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. |
99 |
| - args '--mod', 'rebornstorage', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') |
| 62 | + // This run config launches GameTestServer and runs all registered gametests, then exits. |
| 63 | + // By default, the server will crash when no gametests are provided. |
| 64 | + // The gametest system is also enabled by default for other run configs under the /test command. |
| 65 | + gameTestServer { |
| 66 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 67 | + } |
100 | 68 |
|
101 |
| - //Patchouli |
102 |
| - property 'mixin.env.remapRefMap', 'true' |
103 |
| - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" |
| 69 | + data { |
| 70 | + // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it |
| 71 | + // workingDirectory project.file('run-data') |
104 | 72 |
|
105 |
| - mods { |
106 |
| - rebornstorage { |
107 |
| - source sourceSets.main |
108 |
| - } |
109 |
| - } |
110 |
| - } |
| 73 | + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. |
| 74 | + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() |
111 | 75 | }
|
112 | 76 | }
|
113 | 77 |
|
| 78 | +// Include resources generated by data generators. |
114 | 79 | sourceSets.main.resources { srcDir 'src/generated/resources' }
|
115 | 80 |
|
116 | 81 | repositories {
|
117 | 82 | maven {
|
118 |
| - url = "https://maven.creeperhost.net" |
| 83 | + name "CreeperHost" |
| 84 | + url 'https://maven.creeperhost.net' |
| 85 | + } |
| 86 | + maven { |
| 87 | + // location of the maven that hosts JEI files since January 2023 |
| 88 | + name = "Jared's maven" |
| 89 | + url = "https://maven.blamejared.com/" |
119 | 90 | }
|
120 | 91 | maven {
|
121 |
| - url "https://www.cursemaven.com" |
| 92 | + url "https://cursemaven.com" |
122 | 93 | content {
|
123 | 94 | includeGroup "curse.maven"
|
124 | 95 | }
|
125 | 96 | }
|
126 |
| - maven { |
127 |
| - url = "https://maven.theillusivec4.top/" |
128 |
| - } |
129 |
| - |
130 |
| -// flatDir { |
131 |
| -// dirs '/libs' |
132 |
| -// } |
133 | 97 | }
|
134 | 98 |
|
135 | 99 | dependencies {
|
136 |
| - minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}" |
137 |
| - |
138 |
| - implementation fg.deobf("com.refinedmods:refinedstorage:${project.rs_version}") { |
| 100 | + // Specify the version of Minecraft to use. |
| 101 | + // Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above. |
| 102 | + // The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version. |
| 103 | + // You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader. |
| 104 | + // And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version. |
| 105 | + // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. |
| 106 | + implementation "net.neoforged:neoforge:${neo_version}" |
| 107 | + implementation "net.creeperhost:polylib-neoforge:${polylib_version}" |
| 108 | + implementation ("com.refinedmods:refinedstorage:${project.rs_version}") { |
139 | 109 | transitive false
|
140 | 110 | }
|
141 |
| -// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") |
142 |
| - |
143 |
| - runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}") |
144 |
| - compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}:api") |
145 |
| - |
146 |
| - // compileOnly fg.deobf("vazkii.patchouli:Patchouli:${project.patchouli_version}:api") |
147 |
| - // runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${project.patchouli_version}") |
148 |
| - |
149 |
| -// compileOnly fg.deobf("team.chisel.ctm:CTM:${project.ctm_version}") |
150 |
| -// runtimeOnly fg.deobf("team.chisel.ctm:CTM:${project.ctm_version}") |
151 | 111 | }
|
152 | 112 |
|
153 |
| -jar { |
154 |
| - manifest { |
155 |
| - attributes(["Specification-Title": archivesBaseName, |
156 |
| - "Specification-Vendor": "gigabit101", |
157 |
| - "Specification-Version": "${project.mod_version}", |
158 |
| - "Implementation-Title": archivesBaseName, |
159 |
| - "Implementation-Version": "${project.mod_version}", |
160 |
| - "Implementation-Vendor" :"gigabit101", |
161 |
| - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) |
| 113 | +// This block of code expands all declared replace properties in the specified resource targets. |
| 114 | +// A missing property will result in an error. Properties are expanded using ${} Groovy notation. |
| 115 | +// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. |
| 116 | +// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html |
| 117 | +tasks.withType(ProcessResources).configureEach { |
| 118 | + var replaceProperties = [ |
| 119 | + minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, |
| 120 | + neo_version : neo_version, neo_version_range: neo_version_range, |
| 121 | + loader_version_range: loader_version_range, |
| 122 | + mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, |
| 123 | + mod_authors : mod_authors, mod_description: mod_description, |
| 124 | + ] |
| 125 | + inputs.properties replaceProperties |
| 126 | + |
| 127 | + filesMatching(['META-INF/mods.toml']) { |
| 128 | + expand replaceProperties + [project: project] |
162 | 129 | }
|
163 | 130 | }
|
164 | 131 |
|
165 |
| -def ENV = System.getenv() |
166 |
| - |
| 132 | +// Example configuration to allow publishing using the maven-publish plugin |
167 | 133 | publishing {
|
168 | 134 | publications {
|
169 | 135 | register('mavenJava', MavenPublication) {
|
170 |
| - groupId "net.gigabit101" |
171 |
| - artifactId = rootProject.archivesBaseName |
| 136 | + groupId "net.creeperhost" |
| 137 | + artifactId rootProject.archivesBaseName |
| 138 | + version version |
172 | 139 | from components.java
|
173 | 140 | }
|
174 | 141 | }
|
175 | 142 | repositories {
|
176 |
| - if (ENV.MAVEN_TOKEN) { |
| 143 | + if (ENV.CREEPERHOST_MAVEN_TOKEN) { |
177 | 144 | maven {
|
178 | 145 | url "https://maven.creeperhost.net/release"
|
| 146 | + allowInsecureProtocol = true |
179 | 147 | credentials {
|
180 |
| - username = "Gigabit101" |
181 |
| - password = "${ENV.MAVEN_TOKEN}" |
| 148 | + username = "githubci" |
| 149 | + password = "${ENV.CREEPERHOST_MAVEN_TOKEN}" |
182 | 150 | }
|
183 | 151 | }
|
184 | 152 | }
|
|
0 commit comments