plugins {
	id 'fabric-loom' version '1.10-SNAPSHOT'
}

base.archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
	mavenCentral()
}

dependencies {
	// To change the versions see the gradle.properties file
	minecraft "com.mojang:minecraft:${project.minecraft_version}"
	mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

	// Fabric API
	modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

	// LuaJ
	include(implementation("org.luaj:luaj-jse:3.0.1"))

	// Configurate
	include(implementation("org.spongepowered:configurate-core:4.1.2"))
	include(implementation("org.spongepowered:configurate-gson:4.1.2"))
	include(implementation("io.leangen.geantyref:geantyref:1.3.16"))

	// Adventure
	include(modImplementation("net.kyori:adventure-platform-fabric:6.2.0"))
	include(implementation("net.kyori:adventure-text-serializer-gson:4.18.0"))
	include(implementation("net.kyori:adventure-text-serializer-legacy:4.18.0"))
}

processResources {
	inputs.property "version", project.version

	filesMatching("fabric.mod.json") {
		expand "version": project.version
	}
}

tasks.withType(JavaCompile).configureEach {
	// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
	it.options.release = 21

	sourceCompatibility = JavaVersion.VERSION_21
	targetCompatibility = JavaVersion.VERSION_21
}

jar {
	from("LICENSE") {
		rename { "${it}_${base.archivesName}"}
	}
}
