Bundle required fabric api jars.

This commit is contained in:
wizjany 2019-09-19 21:11:23 -04:00
parent 44dc926c49
commit e77393a51e
2 changed files with 23 additions and 18 deletions

View File

@ -1,6 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapJarTask
import kotlin.reflect.KClass
buildscript { buildscript {
repositories { repositories {
@ -16,7 +15,7 @@ buildscript {
} }
dependencies { dependencies {
"classpath"("net.fabricmc:fabric-loom:0.2.3-SNAPSHOT") "classpath"("net.fabricmc:fabric-loom:0.2.5-SNAPSHOT")
"classpath"("org.spongepowered:mixin:0.7.11-SNAPSHOT") "classpath"("org.spongepowered:mixin:0.7.11-SNAPSHOT")
} }
} }
@ -27,9 +26,8 @@ applyShadowConfiguration()
apply(plugin = "fabric-loom") apply(plugin = "fabric-loom")
val minecraftVersion = "1.14.4" val minecraftVersion = "1.14.4"
val fabricVersion = "0.3.0+build.200" val yarnMappings = "1.14.4+build.12"
val yarnMappings = "1.14.4+build.1" val loaderVersion = "0.6.2+build.166"
val loaderVersion = "0.4.8+build.155"
configurations.all { configurations.all {
resolutionStrategy { resolutionStrategy {
@ -45,7 +43,15 @@ dependencies {
"mappings"("net.fabricmc:yarn:$yarnMappings") "mappings"("net.fabricmc:yarn:$yarnMappings")
"modCompile"("net.fabricmc:fabric-loader:$loaderVersion") "modCompile"("net.fabricmc:fabric-loader:$loaderVersion")
"modCompile"("net.fabricmc.fabric-api:fabric-api:$fabricVersion") listOf(
"net.fabricmc.fabric-api:fabric-api-base:0.1.0+2983bc0442",
"net.fabricmc.fabric-api:fabric-events-interaction-v0:0.1.1+591e97ae42",
"net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.1+591e97ae42",
"net.fabricmc.fabric-api:fabric-networking-v0:0.1.3+591e97ae42"
).forEach {
"include"(it)
"modImplementation"(it)
}
"testCompile"("org.mockito:mockito-core:1.9.0-rc1") "testCompile"("org.mockito:mockito-core:1.9.0-rc1")
} }
@ -96,16 +102,12 @@ artifacts {
add("archives", tasks.named("deobfJar")) add("archives", tasks.named("deobfJar"))
} }
// intellij has trouble detecting RemapJarTask as a subclass of Task tasks.register<RemapJarTask>("remapShadowJar") {
@Suppress("UNCHECKED_CAST")
val remapJarIntellijHack = RemapJarTask::class as KClass<Task>
tasks.register("remapShadowJar", remapJarIntellijHack) {
(this as RemapJarTask).run {
val shadowJar = tasks.getByName<ShadowJar>("shadowJar") val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
dependsOn(shadowJar) dependsOn(shadowJar)
setInput(shadowJar.archiveFile) input.set(shadowJar.archiveFile)
setOutput(shadowJar.archiveFile.get().asFile.absolutePath.replace(Regex("-dev\\.jar$"), ".jar")) archiveFileName.set(shadowJar.archiveFileName.get().replace(Regex("-dev\\.jar$"), ".jar"))
} addNestedDependencies.set(true)
} }
tasks.named("assemble").configure { tasks.named("assemble").configure {

View File

@ -29,7 +29,10 @@
"depends": { "depends": {
"fabricloader": ">=0.4.0", "fabricloader": ">=0.4.0",
"fabric": "*" "fabric-api-base": "*",
"fabric-events-lifecycle-v0": "*",
"fabric-events-interaction-v0": "*",
"fabric-networking-v0": "*"
}, },
"mixins": [ "mixins": [
"worldedit.mixins.json" "worldedit.mixins.json"