1+ plugins {
2+ id(" fabric-loom" ) version " 1.13-SNAPSHOT"
3+ id(" maven-publish" )
4+ id(" com.modrinth.minotaur" ) version " 2.+"
5+ kotlin(" jvm" ) version " 2.2.10"
6+ id(" com.google.devtools.ksp" ) version " 2.2.10-2.0.2"
7+ id(" dev.kikugie.fletching-table.fabric" ) version " 0.1.0-alpha.22"
8+ }
9+
10+ version = " ${project.property(" mod_version" )} +${stonecutter.current.project} "
11+ group = project.property(" maven_group" ) as String
12+
13+ base.archivesName = project.property(" archives_base_name" ) as String
14+
15+ repositories {
16+ maven(" https://maven.ladysnake.org/releases" ) { name = " cardinal components" }
17+ maven(" https://maven.terraformersmc.com" ) { name = " mod menu" }
18+ maven(" https://api.modrinth.com/maven" ) { name = " modrinth" }
19+ maven(" https://jitpack.io" ) { name = " jitpack" }
20+ maven(" https://maven.isxander.dev/releases" ) { name = " Xander Maven" }
21+ }
22+
23+ fabricApi {
24+ configureDataGeneration {
25+ client = true
26+ }
27+ }
28+
29+ dependencies {
30+ // minecraft and fabric
31+ fun bundleAPI (dependencyNotation : Any ) {
32+ modApi(dependencyNotation)
33+ include(dependencyNotation)
34+ }
35+
36+ fun compat (dependencyNotation : String ) {
37+ modCompileOnly(dependencyNotation) {
38+ exclude(" net.fabricmc.fabric-api" )
39+ }
40+ modRuntimeOnly(dependencyNotation) {
41+ exclude(" net.fabricmc.fabric-api" )
42+ }
43+ }
44+
45+ minecraft(" com.mojang:minecraft:${stonecutter.current.project} " )
46+ mappings(" net.fabricmc:yarn:${property(" deps.yarn_mappings" )} :v2" )
47+ modImplementation(" net.fabricmc:fabric-loader:${project.property(" loader_version" )} " )
48+
49+ modImplementation(" net.fabricmc.fabric-api:fabric-api:${project.property(" deps.fabric_api" )} " )
50+
51+ bundleAPI(" dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.property(" deps.cca" )} " )
52+ bundleAPI(" dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.property(" deps.cca" )} " )
53+
54+ modApi(" dev.isxander:yet-another-config-lib:${project.property(" deps.yacl" )} " )
55+ modApi(" com.terraformersmc:modmenu:${project.property(" deps.modmenu" )} " )
56+
57+ modRuntimeOnly(" maven.modrinth:sodium:${project.property(" deps.sodium" )} " )
58+
59+ compat(" com.github.CrimsonDawn45:Fabric-Shield-Lib:v${project.property(" deps.fabric_shield_lib" )} " )
60+ compat(" com.github.Chocohead:Fabric-ASM:v2.3" )
61+ compat(" maven.modrinth:midnightlib:${project.property(" deps.midnightlib" )} " )
62+ }
63+
64+ fletchingTable {
65+ mixins.create(" main" ) {
66+ // Default matches the default value in the annotation
67+ mixin(" default" , " ${project.property(" archives_base_name" )} .mixins.json" )
68+ }
69+ mixins.all {
70+ automatic = true
71+ }
72+ }
73+
74+ tasks.processResources {
75+ val modVersion = project.version
76+ val minecraftVersion = stonecutter.current.version
77+ inputs.property(" version" , modVersion)
78+ inputs.property(" minecraft" , minecraftVersion)
79+
80+ filesMatching(" fabric.mod.json" ) {
81+ expand(
82+ mapOf (
83+ " version" to modVersion,
84+ " minecraft" to minecraftVersion
85+ )
86+ )
87+ }
88+ }
89+
90+ loom {
91+ runConfigs.all {
92+ ideConfigGenerated(true )
93+ runDir = " ../../run"
94+ }
95+
96+ runConfigs[" client" ].apply {
97+ programArgs(" --username=Survivalblock" , " --uuid=c45e97e6-94ef-42da-8b5e-0c3209551c3f" )
98+ }
99+
100+ fabricModJsonPath = rootProject.file(" src/main/resources/fabric.mod.json" )
101+ }
102+
103+ tasks.withType<JavaCompile >().configureEach {
104+ options.release.set(21 )
105+ }
106+
107+ java {
108+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
109+ // if it is present.
110+ // If you remove this line, sources will not be generated.
111+ withSourcesJar()
112+
113+ val java = if (stonecutter.eval(stonecutter.current.version, " >=1.20.5" ))
114+ JavaVersion .VERSION_21 else JavaVersion .VERSION_17
115+
116+ targetCompatibility = java
117+ sourceCompatibility = java
118+ }
119+
120+ tasks.jar {
121+ inputs.property(" archivesName" , project.base.archivesName)
122+
123+ from(" LICENSE" ) {
124+ rename { " ${it} _${base.archivesName} " }
125+ }
126+ }
0 commit comments