Skip to content

Commit f5d4094

Browse files
authored
Merge pull request #8 from cxntered/main
2 parents 163c427 + cb0b922 commit f5d4094

38 files changed

Lines changed: 201 additions & 690 deletions

build.gradle.kts

Lines changed: 86 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,104 @@
1-
@file:Suppress("UnstableApiUsage", "PropertyName")
2-
3-
import dev.deftu.gradle.utils.GameSide
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
43

54
plugins {
6-
java
7-
kotlin("jvm")
8-
id("dev.deftu.gradle.multiversion") // Applies preprocessing for multiple versions of Minecraft and/or multiple mod loaders.
9-
id("dev.deftu.gradle.tools") // Applies several configurations to things such as the Java version, project name/version, etc.
10-
id("dev.deftu.gradle.tools.resources") // Applies resource processing so that we can replace tokens, such as our mod name/version, in our resources.
11-
id("dev.deftu.gradle.tools.bloom") // Applies the Bloom plugin, which allows us to replace tokens in our source files, such as being able to use `@MOD_VERSION` in our source files.
12-
id("dev.deftu.gradle.tools.shadow") // Applies the Shadow plugin, which allows us to shade our dependencies into our mod JAR. This is NOT recommended for Fabric mods, but we have an *additional* configuration for those!
13-
id("dev.deftu.gradle.tools.minecraft.loom") // Applies the Loom plugin, which automagically configures Essential's Architectury Loom plugin for you.
14-
id("dev.deftu.gradle.tools.minecraft.releases") // Applies the Minecraft auto-releasing plugin, which allows you to automatically release your mod to CurseForge and Modrinth.
5+
id("net.fabricmc.fabric-loom-remap") version "1.14-SNAPSHOT"
6+
id("org.jetbrains.kotlin.jvm") version "2.3.0"
7+
id("dev.deftu.gradle.bloom") version "0.2.0"
158
}
169

17-
toolkitMultiversion {
18-
moveBuildsToRootProject = true
10+
val modid = property("mod.id")
11+
val modname = property("mod.name")
12+
val modversion = property("mod.version")
13+
val mcversion = property("minecraft_version")
14+
15+
base {
16+
archivesName.set(property("mod.id") as String)
1917
}
2018

21-
toolkitLoomHelper {
22-
useOneConfig {
23-
version = "1.0.0-alpha.153"
24-
loaderVersion = "1.1.0-alpha.49"
19+
repositories {
20+
maven("https://maven.parchmentmc.org")
21+
maven("https://repo.polyfrost.org/releases")
22+
maven("https://repo.polyfrost.org/snapshots")
23+
maven("https://maven.gegy.dev/releases")
24+
}
2525

26-
usePolyMixin = true
27-
polyMixinVersion = "0.8.4+build.2"
26+
loom {
27+
runConfigs.all {
28+
ideConfigGenerated(stonecutter.current.isActive)
29+
runDir = "../../run" // This sets the run folder for all mc versions to the same folder. Remove this line if you want individual run folders.
30+
}
2831

29-
applyLoaderTweaker = true
32+
runConfigs.remove(runConfigs["server"]) // Removes server run configs
33+
}
3034

31-
for (module in arrayOf("commands", "config", "config-impl", "events", "internal", "ui", "utils")) {
32-
+module
35+
dependencies {
36+
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
37+
@Suppress("UnstableApiUsage")
38+
mappings(loom.layered {
39+
officialMojangMappings()
40+
optionalProp("${property("parchment_version")}") {
41+
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:$it@zip")
3342
}
34-
}
35-
useDevAuth("1.2.1")
36-
useMixinExtras("0.4.1")
43+
optionalProp("${property("yalmm_version")}") {
44+
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.$it")
45+
}
46+
})
47+
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
48+
modImplementation("org.polyfrost.oneconfig:${property("minecraft_version")}-fabric:1.0.0-alpha.181")
49+
modImplementation("org.polyfrost.oneconfig:commands:1.0.0-alpha.181")
50+
modImplementation("org.polyfrost.oneconfig:config:1.0.0-alpha.181")
51+
modImplementation("org.polyfrost.oneconfig:config-impl:1.0.0-alpha.181")
52+
modImplementation("org.polyfrost.oneconfig:events:1.0.0-alpha.181")
53+
modImplementation("org.polyfrost.oneconfig:internal:1.0.0-alpha.181")
54+
modImplementation("org.polyfrost.oneconfig:ui:1.0.0-alpha.181")
55+
modImplementation("org.polyfrost.oneconfig:utils:1.0.0-alpha.181")
56+
modImplementation("org.polyfrost.oneconfig:hud:1.0.0-alpha.181")
57+
}
3758

38-
// Turns off the server-side run configs, as we're building a client-sided mod.
39-
disableRunConfigs(GameSide.SERVER)
59+
bloom {
60+
replacement("@MOD_ID@", modid!!)
61+
replacement("@MOD_NAME@", modname!!)
62+
replacement("@MOD_VERSION@", modversion!!)
63+
}
4064

41-
// Defines the name of the Mixin refmap, which is used to map the Mixin classes to the obfuscated Minecraft classes.
42-
if (!mcData.isNeoForge) {
43-
useMixinRefMap(modData.id)
44-
}
65+
tasks.processResources {
66+
val props = mapOf(
67+
"mod_id" to modid,
68+
"mod_name" to modname,
69+
"mod_version" to modversion,
70+
"mc_version" to mcversion,
71+
"loader_version" to providers.gradleProperty("loader_version").get()
72+
)
4573

46-
if (mcData.isForge) {
47-
// Configures the Mixin tweaker if we are building for Forge.
48-
useForgeMixin(modData.id)
74+
inputs.properties(props)
75+
76+
filesMatching("fabric.mod.json") {
77+
expand(props)
4978
}
5079
}
5180

52-
dependencies {
53-
// Add (Legacy) Fabric API as dependencies (these are both optional but are particularly useful).
54-
if (mcData.isFabric) {
55-
if (mcData.isLegacyFabric) {
56-
// 1.8.9 - 1.13
57-
modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${mcData.dependencies.legacyFabric.legacyFabricApiVersion}")
58-
} else {
59-
// 1.16.5+
60-
modImplementation("net.fabricmc.fabric-api:fabric-api:${mcData.dependencies.fabric.fabricApiVersion}")
61-
}
81+
tasks.withType<JavaCompile>().configureEach {
82+
options.release.set(21)
83+
}
84+
85+
tasks.withType<KotlinCompile>().configureEach {
86+
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
87+
}
88+
89+
java {
90+
withSourcesJar()
91+
sourceCompatibility = JavaVersion.VERSION_21
92+
targetCompatibility = JavaVersion.VERSION_21
93+
}
94+
95+
tasks.jar {
96+
inputs.property("archivesName", base.archivesName)
97+
98+
from("LICENSE") {
99+
rename { "${it}_${inputs.properties["archivesName"]}" }
62100
}
63101
}
102+
103+
fun <T> optionalProp(property: String, block: (String) -> T?): T? =
104+
findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let(block)

gradle.properties

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
2-
polyfrost.defaults.loom=1
1+
mod.name=PolyWeather
2+
mod.id=polyweather
3+
mod.version=1.1.0-alpha.1
4+
mod.group=org.polyfrost
5+
6+
loom_version=1.14-SNAPSHOT
7+
loader_version=0.18.4
8+
minecraft_version=[VERSIONED]
9+
parchment_version=[VERSIONED]
10+
yalmm_version=[VERSIONED]
11+
312
org.gradle.daemon=true
413
org.gradle.parallel=true
514
org.gradle.configureoncommand=true
615
org.gradle.parallel.threads=4
716
org.gradle.jvmargs=-Xmx2G
817

9-
# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod.*` AND REMOVE THIS COMMENT.
10-
11-
# Sets the name of your mod.
12-
mod.name=PolyWeather
13-
# Sets the ID of your mod that mod loaders use to recognize it.
14-
mod.id=polyweather
15-
# Sets the version of your mod. Make sure to update this when you make changes according to the SemVer specification.
16-
mod.version=1.1.0-alpha.1
17-
# Sets the Maven group ID of your mod. This is effectively unused but is good practice to set regardless.
18-
mod.group=org.polyfrost
18+
# Fix YALMM
19+
fabric.loom.dropNonIntermediateRootMethods=true

gradle/wrapper/gradle-wrapper.jar

2.13 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

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.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

root.gradle.kts

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)