plugins {
	id 'net.fabricmc.fabric-loom' version "${loom_version}"
	id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

base {
	archivesName = project.archives_base_name
}

repositories {
	// Loom adds the core Fabric and Minecraft repositories automatically.
}

loom {
	splitEnvironmentSourceSets()

	mods {
		"portals" {
			sourceSet sourceSets.main
			sourceSet sourceSets.client
		}
	}
}

dependencies {
	minecraft "com.mojang:minecraft:${project.minecraft_version}"
	implementation "net.fabricmc:fabric-loader:${project.loader_version}"
	implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
}

processResources {
	def properties = [
		version: project.version,
		minecraft_version: project.minecraft_version,
		loader_version: project.loader_version
	]

	inputs.properties properties

	filesMatching("fabric.mod.json") {
		expand properties
	}
}

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

java {
	withSourcesJar()

	toolchain {
		languageVersion = JavaLanguageVersion.of(25)
	}
}

jar {
	from("LICENSE") {
		rename { "${it}_${project.archives_base_name}" }
	}
}

publishing {
	publications {
		create("mavenJava", MavenPublication) {
			artifactId = project.archives_base_name
			from components.java
		}
	}

	repositories {
		// Add a Maven repository here when you are ready to publish.
	}
}
