apply plugin: 'java'
apply plugin: 'application'

group = 'minecraft'
version = '1.8.8'

compileJava {
    sourceCompatibility = targetCompatibility = 1.8
    options.encoding = 'UTF-8'
}

application {
    mainClassName = 'net.minecraft.client.main.Main'
}

run {
    workingDir = new File(buildDir, 'run')
    if (!workingDir.exists()) {
        workingDir.mkdir()
    }

    systemProperty 'java.library.path', file("$buildDir/natives/windows")
    args '--version', '1.8.8', '--accessToken', '0', '--assetsDir', 'assets', '--assetIndex', "1.8", '--userProperties', '{}'
}

repositories {
    mavenLocal()
    mavenCentral()
    flatDir { dirs '../libs' }
}

dependencies {
    compile name: 'com/mojang/authlib/1.5.21/authlib-1.5.21'
    compile name: 'tv/twitch/twitch/6.5/twitch-6.5'
    compile name: 'com/paulscode/soundsystem/20120107/soundsystem-20120107'
    compile name: 'com/paulscode/codecjorbis/20101023/codecjorbis-20101023'
    compile name: 'com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824'
    compile name: 'oshi-project/oshi-core/1.1/oshi-core-1.1'

    compile 'org.lwjgl.lwjgl:lwjgl:2.9.3'
    compile 'org.lwjgl.lwjgl:lwjgl_util:2.9.3'
    compile 'com.ibm.icu:icu4j:52.2'
    compile 'net.sf.jopt-simple:jopt-simple:4.6'
    compile 'org.apache.commons:commons-lang3:3.3.2'
    compile 'com.google.guava:guava:17.0'
    compile 'org.apache.logging.log4j:log4j-core:2.0-beta9'
    compile 'io.netty:netty-all:4.0.23.Final'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'commons-io:commons-io:2.4'
}

task copyNativesWindows {
    doLast {
        copy {
            def resolvedArtifacts = configurations.compile.resolvedConfiguration.resolvedArtifacts
            def matches = resolvedArtifacts.findAll { it.classifier == 'natives-windows' }
            from matches.collect { it.file }.collect { zipTree(it) }
            into "$buildDir/natives/windows"
        }
    }
}

