Skip to content

Commit 5197784

Browse files
committed
Down port to MinecraftForge 1.20.1
1 parent 700a54d commit 5197784

31 files changed

+704
-600
lines changed

build.gradle.kts

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,2 @@
1-
import net.neoforged.gradle.dsl.common.runs.run.Run
2-
3-
plugins {
4-
alias(neoforged.plugins.userdev).apply(false)
5-
}
6-
7-
subprojects {
8-
configurations {
9-
val minecraft = create("minecraft") {
10-
isCanBeConsumed = false
11-
isCanBeResolved = true
12-
13-
// N.B. this is important until https://github.com/neoforged/FancyModLoader/issues/124 is resolved
14-
isTransitive = false
15-
}
16-
17-
val mod = create("mod") {
18-
isCanBeConsumed = false
19-
isCanBeResolved = true
20-
21-
isTransitive = false
22-
}
23-
24-
register("compileClasspath") {
25-
extendsFrom(minecraft)
26-
extendsFrom(mod)
27-
}
28-
register("runtimeClasspath") {
29-
extendsFrom(minecraft)
30-
}
31-
}
32-
}
33-
34-
subprojects {
35-
afterEvaluate {
36-
extensions.configure<JavaPluginExtension> {
37-
// toolchain.vendor.set(JvmVendorSpec)
38-
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
39-
}
40-
41-
this.extensions.configure<NamedDomainObjectContainer<Run>> {
42-
configureEach {
43-
dependencies {
44-
runtime(configurations.getByName("mod"))
45-
}
46-
}
47-
}
48-
}
49-
}
1+
group = "dev.compactmachines"
2+
version = "20.1.0"

build.gradle.kts.old

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import net.neoforged.gradle.dsl.common.runs.run.Run
2+
3+
plugins {
4+
alias(neoforged.plugins.userdev).apply(false)
5+
}
6+
7+
subprojects {
8+
configurations {
9+
val minecraft = create("minecraft") {
10+
isCanBeConsumed = false
11+
isCanBeResolved = true
12+
13+
// N.B. this is important until https://github.com/neoforged/FancyModLoader/issues/124 is resolved
14+
isTransitive = false
15+
}
16+
17+
val mod = create("mod") {
18+
isCanBeConsumed = false
19+
isCanBeResolved = true
20+
21+
isTransitive = false
22+
}
23+
24+
register("compileClasspath") {
25+
extendsFrom(minecraft)
26+
extendsFrom(mod)
27+
}
28+
register("runtimeClasspath") {
29+
extendsFrom(minecraft)
30+
}
31+
}
32+
}
33+
34+
subprojects {
35+
afterEvaluate {
36+
extensions.configure<JavaPluginExtension> {
37+
// toolchain.vendor.set(JvmVendorSpec)
38+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
39+
}
40+
41+
this.extensions.configure<NamedDomainObjectContainer<Run>> {
42+
configureEach {
43+
dependencies {
44+
runtime(configurations.getByName("mod"))
45+
}
46+
}
47+
}
48+
}
49+
}

gradle.properties

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@
22
# This is required to provide enough memory for the Minecraft decompilation process.
33
org.gradle.jvmargs = -Xmx3G
44
org.gradle.daemon = false
5-
6-
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
7-
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
8-
neogradle.subsystems.parchment.minecraftVersion=1.20.6
9-
neogradle.subsystems.parchment.mappingsVersion=2024.05.01
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

levels/build.gradle.kts

Lines changed: 21 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,33 @@
1-
@file:Suppress("SpellCheckingInspection")
2-
3-
import org.ajoberstar.grgit.Grgit
4-
import java.text.SimpleDateFormat
5-
import java.util.*
6-
7-
var envVersion: String = System.getenv("VERSION") ?: "9.9.9"
8-
if (envVersion.startsWith("v"))
9-
envVersion = envVersion.trimStart('v')
10-
11-
val isRelease: Boolean = (System.getenv("RELEASE") ?: "false").equals("true", true)
12-
13-
fun prop(name: String): String {
14-
if (project.properties.containsKey(name))
15-
return project.property(name) as String;
16-
17-
return "";
18-
}
19-
201
plugins {
21-
id("idea")
22-
id("eclipse")
23-
id("maven-publish")
24-
id("java-library")
25-
alias(neoforged.plugins.userdev)
26-
id("org.ajoberstar.grgit") version ("5.2.1")
27-
}
28-
29-
base {
30-
archivesName.set("levels")
31-
group = "dev.compactmods.gander"
32-
version = envVersion
2+
idea
3+
alias(forge.plugins.forgegradle)
4+
alias(forge.plugins.mixingradle)
335
}
346

35-
repositories {
36-
mavenLocal()
37-
}
7+
group = rootProject.group
8+
version = rootProject.version
9+
base.archivesName = "levels"
3810

39-
dependencies {
40-
compileOnly(neoforged.neoforge)
41-
}
11+
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
4212

43-
tasks.withType<ProcessResources> {
44-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
13+
minecraft {
14+
mappings("official", forge.versions.minecraft.get())
15+
copyIdeResources = true
4516
}
4617

47-
tasks.withType<JavaCompile> {
48-
options.encoding = "UTF-8"
49-
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
18+
mixin {
19+
add(sourceSets[SourceSet.MAIN_SOURCE_SET_NAME], "gander_levels.refmap.json")
20+
config("gander_levels.mixins.json")
5021
}
5122

52-
tasks.withType<Jar> {
53-
val mainGit = Grgit.open {
54-
currentDir = project.rootDir
55-
}
56-
57-
manifest {
58-
from("src/main/resources/META-INF/MANIFEST.MF")
59-
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
60-
val name = prop("mod_name")
61-
62-
val attrs = mapOf<String, Any>(
63-
"Specification-Title" to name,
64-
"Specification-Vendor" to "CompactMods",
65-
"Specification-Version" to "1",
66-
"Implementation-Title" to name,
67-
"Implementation-Version" to envVersion,
68-
"Implementation-Vendor" to "CompactMods",
69-
"Implementation-Timestamp" to now,
70-
"Minecraft-Version" to mojang.versions.minecraft.get(),
71-
"NeoForge-Version" to neoforged.versions.neoforge.get(),
72-
"Main-Commit" to mainGit.head().id,
73-
"FMLModType" to "GAMELIBRARY",
74-
"Automatic-Module-Name" to "ganderrendering",
75-
"MixinConfigs" to "gander_render.mixins.json"
76-
77-
)
78-
79-
attributes(attrs)
80-
}
23+
dependencies {
24+
minecraft("net.minecraftforge:forge:${forge.versions.minecraft.get()}-${forge.versions.forge.get()}")
25+
annotationProcessor("org.spongepowered:mixin:${forge.versions.mixin.get()}:processor")
8126
}
8227

83-
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/gander"
84-
publishing {
85-
publications.register<MavenPublication>("levels") {
86-
this.artifact(tasks.jar)
87-
from(components.getByName("java"))
88-
}
89-
90-
repositories {
91-
// GitHub Packages
92-
maven(PACKAGES_URL) {
93-
name = "GitHubPackages"
94-
credentials {
95-
username = System.getenv("GITHUB_ACTOR")
96-
password = System.getenv("GITHUB_TOKEN")
97-
}
98-
}
99-
}
28+
tasks.jar {
29+
manifest.attributes(
30+
"FMLModType" to "GAMELIBRARY",
31+
"Automatic-Module-Name" to "ganderlevels"
32+
)
10033
}

levels/build.gradle.kts.old

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
@file:Suppress("SpellCheckingInspection")
2+
3+
import org.ajoberstar.grgit.Grgit
4+
import java.text.SimpleDateFormat
5+
import java.util.*
6+
7+
var envVersion: String = System.getenv("VERSION") ?: "9.9.9"
8+
if (envVersion.startsWith("v"))
9+
envVersion = envVersion.trimStart('v')
10+
11+
val isRelease: Boolean = (System.getenv("RELEASE") ?: "false").equals("true", true)
12+
13+
fun prop(name: String): String {
14+
if (project.properties.containsKey(name))
15+
return project.property(name) as String;
16+
17+
return "";
18+
}
19+
20+
plugins {
21+
id("idea")
22+
id("eclipse")
23+
id("maven-publish")
24+
id("java-library")
25+
alias(neoforged.plugins.userdev)
26+
id("org.ajoberstar.grgit") version ("5.2.1")
27+
}
28+
29+
base {
30+
archivesName.set("levels")
31+
group = "dev.compactmods.gander"
32+
version = envVersion
33+
}
34+
35+
repositories {
36+
mavenLocal()
37+
}
38+
39+
dependencies {
40+
compileOnly(neoforged.neoforge)
41+
}
42+
43+
tasks.withType<ProcessResources> {
44+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
45+
}
46+
47+
tasks.withType<JavaCompile> {
48+
options.encoding = "UTF-8"
49+
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
50+
}
51+
52+
tasks.withType<Jar> {
53+
val mainGit = Grgit.open {
54+
currentDir = project.rootDir
55+
}
56+
57+
manifest {
58+
from("src/main/resources/META-INF/MANIFEST.MF")
59+
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
60+
val name = prop("mod_name")
61+
62+
val attrs = mapOf<String, Any>(
63+
"Specification-Title" to name,
64+
"Specification-Vendor" to "CompactMods",
65+
"Specification-Version" to "1",
66+
"Implementation-Title" to name,
67+
"Implementation-Version" to envVersion,
68+
"Implementation-Vendor" to "CompactMods",
69+
"Implementation-Timestamp" to now,
70+
"Minecraft-Version" to mojang.versions.minecraft.get(),
71+
"NeoForge-Version" to neoforged.versions.neoforge.get(),
72+
"Main-Commit" to mainGit.head().id,
73+
"FMLModType" to "GAMELIBRARY",
74+
"Automatic-Module-Name" to "ganderrendering",
75+
"MixinConfigs" to "gander_render.mixins.json"
76+
77+
)
78+
79+
attributes(attrs)
80+
}
81+
}
82+
83+
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/gander"
84+
publishing {
85+
publications.register<MavenPublication>("levels") {
86+
this.artifact(tasks.jar)
87+
from(components.getByName("java"))
88+
}
89+
90+
repositories {
91+
// GitHub Packages
92+
maven(PACKAGES_URL) {
93+
name = "GitHubPackages"
94+
credentials {
95+
username = System.getenv("GITHUB_ACTOR")
96+
password = System.getenv("GITHUB_TOKEN")
97+
}
98+
}
99+
}
100+
}

0 commit comments

Comments
 (0)