buildscript {
    repositories {
        maven { url = 'https://files.minecraftforge.net/maven' }
        maven { url = 'https://repo.spongepowered.org/maven' }
        mavenCentral()
        maven { url = 'https://maven.izzel.io/releases' }
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forge_gradle_version}"
        classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
        classpath "io.izzel.arclight:arclight-gradle-plugin:$agpVersion"
    }
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.izzel.arclight'

arclight {
    mcVersion = minecraftVersion
    forgeVersion = project.ext.forgeVersion
    bukkitVersion = 'v1_16_R3'
    wipeVersion = true
    reobfVersion = false
    accessTransformer = project.file('bukkit.at')
    packageName = 'spigot'
}

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

minecraft {
    mappings channel: 'snapshot', version: "20210215-1.16.3"
    accessTransformer = project.file('src/main/resources/META-INF/accesstransformer.cfg')
}

repositories {
    maven { url = 'https://repo.spongepowered.org/maven' }
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
    maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
    maven { url = 'https://files.minecraftforge.net/maven/' }
    maven { url = 'https://jitpack.io/' }
    maven { url = 'https://maven.izzel.io/releases' }
}

dependencies {
    minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
    implementation "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar"
    implementation 'org.jetbrains:annotations:19.0.0'
    
    implementation 'org.spongepowered:mixin:0.8.2'
    annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
    
    implementation 'com.github.ArclightTeam:mixin-tools:1.0.0'
    annotationProcessor 'com.github.ArclightTeam:mixin-tools:1.0.0'
    
    implementation 'jline:jline:2.12.1'
    implementation 'net.md-5:SpecialSource:1.9.0'
    implementation 'org.apache.logging.log4j:log4j-jul:2.11.2'
    implementation 'net.md-5:bungeecord-chat:1.16-R0.4'
    implementation 'mysql:mysql-connector-java:5.1.49'
    implementation 'org.yaml:snakeyaml:1.27'
    implementation "io.izzel:tools:$toolsVersion"
    implementation "io.izzel.arclight:arclight-api:$apiVersion"
    implementation project(':i18n-config')
}

remapSpigotJar {
    includes.add('net/minecraft/block/ChestBlock$DoubleInventory')
    includes.add('net/minecraft/tileentity/LecternTileEntity$LecternInventory')
}

processMapping {
    process { csrg, srg ->
        csrg.classes.put('net/minecraft/world/level/ColorResolver', "net/minecraft/server/$bukkitVersion/ColorResolver".toString())
    }
}

generateArclightMeta {
    doFirst {
        throw new StopExecutionException()
    }
}

mixin {
    add sourceSets.main, 'mixins.arclight.refmap.json'
}

compileJava {
    options.compilerArgs << '-XDignore.symbol.file' << '-XDenableSunApiLintControl'
    options.encoding = 'UTF-8'
    options.compilerArgs += [
            "-AreobfTsrgFiles=${project.file('extra_mapping.tsrg').canonicalPath}"
    ]
}
