Skip to content

Commit b026783

Browse files
committed
26.1
1 parent d548e76 commit b026783

29 files changed

Lines changed: 533 additions & 126 deletions

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: "Set up JDK"
4545
uses: actions/setup-java@v4
4646
with:
47-
java-version: 21
47+
java-version: 25
4848
distribution: temurin
4949

5050
- name: "Setup gradle"
@@ -88,7 +88,7 @@ jobs:
8888
- name: "Set up JDK"
8989
uses: actions/setup-java@v4
9090
with:
91-
java-version: 21
91+
java-version: 25
9292
distribution: temurin
9393

9494
- name: "Parse gradle properties"
@@ -148,7 +148,7 @@ jobs:
148148
- name: "Set up JDK"
149149
uses: actions/setup-java@v4
150150
with:
151-
java-version: 21
151+
java-version: 25
152152
distribution: temurin
153153

154154
- name: "Parse gradle properties"

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: "Set up JDK"
8080
uses: actions/setup-java@v4
8181
with:
82-
java-version: 21
82+
java-version: 25
8383
distribution: temurin
8484

8585
- name: "Setup Gradle"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2.0.20
2+
3+
- Ported to 26.1
4+
- Added "/structurify structure list" command
5+
- Added "/structurify structure enable" command
6+
- Added "/structurify structure disable" command
7+
18
## 2.0.19
29

310
- Fixed load/save of structure set's "is_disabled" property

buildSrc/build.gradle.kts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import java.util.Properties
2+
13
plugins {
24
`kotlin-dsl`
35
kotlin("jvm") version "2.2.0"
@@ -9,8 +11,12 @@ repositories {
911
maven("https://maven.kikugie.dev/snapshots")
1012
}
1113

12-
dependencies {
13-
fun plugin(id: String, version: String) = "$id:$id.gradle.plugin:$version"
14+
val rootProps = Properties().apply {
15+
rootDir.parentFile.resolve("gradle.properties").inputStream().use(::load)
16+
}
1417

15-
implementation("dev.kikugie:stonecutter:0.8.3")
18+
val stonecutterVersion: String = rootProps.getProperty("stonecutter_version")
19+
20+
dependencies {
21+
implementation("dev.kikugie:stonecutter:$stonecutterVersion")
1622
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import dev.kikugie.stonecutter.build.StonecutterBuildExtension
2+
import org.gradle.api.Plugin
3+
import org.gradle.api.Project
4+
import org.gradle.api.tasks.TaskProvider
5+
import org.gradle.jvm.tasks.Jar
6+
import org.gradle.kotlin.dsl.create
7+
import org.gradle.kotlin.dsl.the
8+
9+
open class FabricLoomCompatPlugin : Plugin<Project> {
10+
override fun apply(target: Project): Unit = with(target) {
11+
val current = the<StonecutterBuildExtension>().current.parsed
12+
13+
if (current > "26.0") {
14+
setupNewLoomFacade()
15+
} else {
16+
setupOldLoomFacade()
17+
}
18+
19+
extensions.create<FabricExtensions>("fabric", this, current > "26.0")
20+
}
21+
22+
private fun Project.setupNewLoomFacade() {
23+
plugins.apply("net.fabricmc.fabric-loom")
24+
25+
val names = listOf(
26+
"api", "implementation", "compileOnly", "runtimeOnly", "localRuntime"
27+
)
28+
29+
for (baseName in names) {
30+
val loomified = "mod" + baseName.replaceFirstChar(Char::uppercaseChar)
31+
val modConfiguration = configurations.findByName(loomified) ?: configurations.create(loomified)
32+
33+
configurations.getByName(baseName).extendsFrom(modConfiguration)
34+
}
35+
36+
configurations.findByName("mappings") ?: configurations.register("mappings") {
37+
isCanBeResolved = false
38+
isCanBeConsumed = false
39+
}
40+
}
41+
42+
private fun Project.setupOldLoomFacade() {
43+
plugins.apply("net.fabricmc.fabric-loom-remap")
44+
}
45+
46+
open class FabricExtensions(val project: Project, val isNew: Boolean) {
47+
val modJar: TaskProvider<Jar> by lazy {
48+
val candidate = if (isNew) project.tasks.named("jar")
49+
else project.tasks.named("remapJar")
50+
candidate as TaskProvider<Jar>
51+
}
52+
53+
val modSourcesJar: TaskProvider<Jar> by lazy {
54+
val candidate = if (isNew) project.tasks.named("sourcesJar")
55+
else project.tasks.named("remapSourcesJar")
56+
candidate as TaskProvider<Jar>
57+
}
58+
}
59+
}

buildSrc/src/main/kotlin/build-extensions.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ value class ModData(private val project: Project) {
3535
val license: String get() = modProp("license")
3636
val github: String get() = modProp("github")
3737
val discord: String get() = modProp("discord")
38-
val mc: String get() = depOrNull("minecraft") ?: project.stonecutterBuild.current.version
38+
val mc: String get() = project.stonecutterBuild.current.version
39+
val mcVersion: String get() = prop("minecraft_version")
3940

40-
fun propOrNull(key: String) = project.prop(key)
41+
fun propOrNull(key: String) = project.prop(key)
4142
fun prop(key: String) = requireNotNull(propOrNull(key)) { "Missing '$key'" }
4243
fun modPropOrNull(key: String) = project.prop("mod.$key")
4344
fun modProp(key: String) = requireNotNull(modPropOrNull(key)) { "Missing 'mod.$key'" }

buildSrc/src/main/kotlin/multiloader-common.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ tasks {
107107
}
108108

109109
tasks.named("processResources") {
110-
dependsOn(":common:${commonMod.propOrNull("minecraft_version")}:stonecutterGenerate")
110+
dependsOn(":common:${commonMod.mc}:stonecutterGenerate")
111111
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
implementation-class=FabricLoomCompatPlugin

common/build.gradle.kts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id("multiloader-common")
3-
id("fabric-loom")
3+
id("fabric-loom-compat")
44
id("dev.kikugie.fletching-table.fabric") version "0.1.0-alpha.22"
55
}
66

@@ -20,20 +20,25 @@ fletchingTable {
2020
}
2121
}
2222

23-
loom {
24-
mixin {
25-
useLegacyMixinAp = false
23+
if (stonecutter.eval(commonMod.mc, "<=1.21.11")) {
24+
loom {
25+
mixin {
26+
useLegacyMixinAp = false
27+
}
2628
}
2729
}
2830

2931
dependencies {
30-
minecraft(group = "com.mojang", name = "minecraft", version = commonMod.mc)
31-
mappings(loom.layered {
32-
officialMojangMappings()
33-
commonMod.depOrNull("parchment")?.let { parchmentVersion ->
34-
parchment("org.parchmentmc.data:parchment-${commonMod.mc}:$parchmentVersion@zip")
35-
}
36-
})
32+
minecraft("com.mojang:minecraft:${commonMod.mcVersion}")
33+
34+
if (stonecutter.eval(commonMod.mc, "<=1.21.11")) {
35+
mappings(loom.layered {
36+
officialMojangMappings()
37+
commonMod.depOrNull("parchment")?.let { parchmentVersion ->
38+
parchment("org.parchmentmc.data:parchment-${commonMod.mc}:$parchmentVersion@zip")
39+
}
40+
})
41+
}
3742

3843
compileOnly("org.spongepowered:mixin:0.8.5")
3944

0 commit comments

Comments
 (0)