import net.neoforged.moddevgradle.internal.RunUtils

plugins {
	id 'java-library'
	id 'idea'
}

repositories {
	maven { url = 'https://maven.neoforged.net/releases' }
	maven {
		name 'Mojang'
		url 'https://libraries.minecraft.net'
	}
	mavenCentral()
}

java {
	toolchain {
		languageVersion.set(JavaLanguageVersion.of(21))
	}
}

compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-this-escape" << "-Werror"

dependencies {
	compileOnly "org.jetbrains:annotations:24.0.1"
	compileOnly "net.neoforged.fancymodloader:loader:4.0.8"

	// This is for javadoc, please do not actually classload anything from the main source set!!!!!!
	def jankAssShit = RunUtils.getIntellijOutputDirectory(rootProject)
	if (jankAssShit != null) {
		jankAssShit = jankAssShit.apply(rootProject).toPath().resolve('production')
		compileOnly files(jankAssShit.resolve('classes'), jankAssShit.resolve('resources'))
	}
}

jar {
	manifest {
		attributes(
			'FMLModType': "LIBRARY",
			'Specification-Title': "twilightforest-asm",
			'Specification-Vendor': "TeamTwilight",
			'Specification-Version': "1",
			'Implementation-Title': project.name,
			'Implementation-Version': project.jar.archiveVersion,
			'Implementation-Vendor': "TeamTwilight",
			'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
		)
	}
}