plugins {
	id 'fabric-loom' version '1.6-SNAPSHOT'
	id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

repositories {
}

//UDE FOR MAPPINGS https://linkie.shedaniel.dev/mappings?namespace=yarn&version=1.19.4&search=
dependencies {
	minecraft "com.mojang:minecraft:${project.minecraft_version}"
	mappings loom.officialMojangMappings()
	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

	modImplementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
	include group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'

	modImplementation 'org.json:json:20231013'
	include 'org.json:json:20231013'

}

base {
	archivesName = project.archives_base_name
}

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

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

tasks.withType(JavaCompile).configureEach {
	it.options.release = 21
}

java {
	// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
	// if it is present.
	// If you remove this line, sources will not be generated.
	withSourcesJar()

	sourceCompatibility = JavaVersion.VERSION_21
	targetCompatibility = JavaVersion.VERSION_21
}

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

// configure the maven publication
publishing {
	publications {
		mavenJava(MavenPublication) {
			from components.java
		}
	}
}
