Skip to content

Commit 280990b

Browse files
committed
Initial Commit
0 parents  commit 280990b

16 files changed

+587
-0
lines changed

Example Mod/.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CURSEFORGE_TOKEN=
2+
MODRINTH_TOKEN=

Example Mod/.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/gradlew text eol=lf
2+
*.bat text eol=crlf

Example Mod/.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Gradle
2+
.gradle/
3+
build/
4+
out/
5+
classes/
6+
# Eclipse
7+
*.launch
8+
# IntelliJ IDEA
9+
.idea/
10+
*.iml
11+
*.ipr
12+
*.iws
13+
# Visual Studio Code
14+
.settings/
15+
.vscode/
16+
bin/
17+
.classpath
18+
.project
19+
# macOS
20+
*.DS_Store
21+
# Fabric
22+
run/
23+
# Java
24+
hs_err_*.log
25+
replay_*.log
26+
*.hprof
27+
*.jfr
28+
# Kotlin
29+
.kotlin/
30+
# Static Analysis
31+
.PVS-Studio/
32+
# Security
33+
.env

Example Mod/build.gradle.kts

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import net.darkhax.curseforgegradle.TaskPublishCurseForge
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4+
plugins {
5+
id("fabric-loom")
6+
kotlin("jvm")
7+
id("com.modrinth.minotaur")
8+
id("net.darkhax.curseforgegradle")
9+
id("co.uzzu.dotenv.gradle")
10+
}
11+
base.archivesName = project.extra["archives_base_name"] as String
12+
version = project.extra["mod_version"] as String
13+
group = project.extra["maven_group"] as String
14+
dependencies {
15+
minecraft("com.mojang", "minecraft", project.extra["minecraft_version"] as String)
16+
mappings("net.fabricmc", "yarn", project.extra["yarn_mappings"] as String, null, "v2")
17+
modImplementation("net.fabricmc", "fabric-loader", project.extra["loader_version"] as String)
18+
modImplementation("net.fabricmc.fabric-api", "fabric-api", project.extra["fabric_version"] as String)
19+
modImplementation("net.fabricmc", "fabric-language-kotlin", project.extra["fabric_language_kotlin_version"] as String)
20+
}
21+
tasks {
22+
val javaVersion = JavaVersion.toVersion((project.extra["java_version"] as String).toInt())
23+
withType<JavaCompile>().configureEach {
24+
options.encoding = "UTF-8"
25+
sourceCompatibility = javaVersion.toString()
26+
targetCompatibility = javaVersion.toString()
27+
options.release = javaVersion.toString().toInt()
28+
}
29+
withType<JavaExec>().configureEach { defaultCharacterEncoding = "UTF-8" }
30+
withType<Javadoc>().configureEach { options.encoding = "UTF-8" }
31+
withType<Test>().configureEach { defaultCharacterEncoding = "UTF-8" }
32+
withType<KotlinCompile>().configureEach {
33+
compilerOptions {
34+
extraWarnings = true
35+
jvmTarget = JvmTarget.valueOf("JVM_$javaVersion")
36+
}
37+
}
38+
jar { from("LICENSE") { rename { "${it}_${base.archivesName.get()}" } } }
39+
processResources {
40+
filesMatching("fabric.mod.json") { expand(mutableMapOf("version" to project.extra["mod_version"] as String, "fabricloader" to project.extra["loader_version"] as String, "fabric_api" to project.extra["fabric_version"] as String, "fabric_language_kotlin" to project.extra["fabric_language_kotlin_version"] as String, "minecraft" to project.extra["minecraft_version"] as String, "java" to project.extra["java_version"] as String)) }
41+
filesMatching("*.mixins.json") { expand(mutableMapOf("java" to project.extra["java_version"] as String)) }
42+
}
43+
java {
44+
toolchain.languageVersion = JavaLanguageVersion.of(javaVersion.toString())
45+
sourceCompatibility = javaVersion
46+
targetCompatibility = javaVersion
47+
withSourcesJar()
48+
}
49+
register<TaskPublishCurseForge>("publishCurseForge") {
50+
disableVersionDetection()
51+
apiToken = env.fetch("CURSEFORGE_TOKEN", "")
52+
val file = upload("Replace this with the CurseForge project ID as an Integer", remapJar)
53+
file.displayName = "[${project.extra["minecraft_version"] as String}] Mod Name"
54+
file.addEnvironment("Client", "Server")
55+
file.changelog = ""
56+
file.releaseType = "release"
57+
file.addModLoader("Fabric")
58+
file.addGameVersion(project.extra["minecraft_version"] as String)
59+
}
60+
}
61+
modrinth {
62+
token.set(env.fetch("MODRINTH_TOKEN", ""))
63+
projectId.set("Replace this with the slug to the Modrinth mod page")
64+
uploadFile.set(tasks.remapJar)
65+
gameVersions.addAll(project.extra["minecraft_version"] as String)
66+
versionName.set("[${project.extra["minecraft_version"] as String}] Mod Name")
67+
dependencies { required.project("fabric-api", "fabric-language-kotlin") }
68+
}

Example Mod/gradle.properties

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##########################################################################
2+
# Standard Properties
3+
kotlin.code.style = official
4+
org.gradle.jvmargs = -Xmx1G
5+
org.gradle.warning.mode = all
6+
##########################################################################
7+
# Standard Fabric Dependencies
8+
# Check these on https://fabricmc.net/develop/
9+
minecraft_version = 1.21.4
10+
yarn_mappings = 1.21.4+build.2
11+
loader_version = 0.16.9
12+
# Fabric API
13+
fabric_version = 0.111.0+1.21.4
14+
loom_version = 1.9-SNAPSHOT
15+
java_version = 21
16+
##########################################################################
17+
# Mod Properties
18+
mod_version = 1.0.0
19+
maven_group = com.author
20+
archives_base_name = mod-name
21+
##########################################################################
22+
# Kotlin Dependencies
23+
# Check this on https://kotlinlang.org/docs/releases.html
24+
kotlin_version = 2.1.0
25+
# Check this on https://www.curseforge.com/minecraft/mc-mods/fabric-language-kotlin/
26+
fabric_language_kotlin_version = 1.13.0+kotlin.2.1.0
27+
##########################################################################
28+
# Automatic Mod Upload Plugins
29+
# Check this on https://plugins.gradle.org/plugin/com.modrinth.minotaur/
30+
minotaur_version = 2.8.7
31+
# Check this on https://plugins.gradle.org/plugin/net.darkhax.curseforgegradle/
32+
curseforge_gradle_version = 1.1.25
33+
# Check this on https://plugins.gradle.org/plugin/co.uzzu.dotenv.gradle/
34+
dotenv_version = 4.0.0
35+
##########################################################################
51.6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Check this on https://gradle.org/releases/
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
3+
distributionBase=GRADLE_USER_HOME
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)