尝试通过build.gradle添加Applied Energistics api

时间:2018-02-13 23:27:32

标签: gradle minecraft minecraft-forge

我开始使用Minecraft mod,但我无法使build.gradle正确。

我想在应用能量之上创建一个mod ,但是当我将 mod添加为gradle依赖时,我无法构建它。我在其他存储库中查看了所有依赖项,但是当我构建它时会出现如下错误,以及一般Minecraft代码库中的一些其他错误

Error:(3, 26) java: package net.minecraft.init does not exist

这是我现在的代码:

buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = mod_version + "-" + mod_channel
group = mod_group
archivesBaseName = mod_basename

sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = '1.8'
}

minecraft {
    version = minecraft_version + "-" + forge_version

    replaceIn "package-info.java"

    replace "@version@", project.version
    replace "@modversion@", mod_version
    replace "@modchannel@", mod_channel

    // used when launching minecraft in dev env
    mappings = mcp_mappings
}

repositories {
    maven {
        name 'Mobius Repo'
        url "http://mobiusstrip.eu/maven"
    }
    maven {
        name = "JEI repo"
        url "http://dvs1.progwml6.com/files/maven"
    }
}

dependencies {
    // installable runtime dependencies
    compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"

    // compile against provided APIs
    compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
    compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"

    // at runtime, use the full JEI jar
    runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"

    deobfCompile "appeng:appliedenergistics2:${ae_verion}"
}

processResources {
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version
    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'

        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }

    // copy everything else except the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

我想添加的版本是:

ae_verion=rv5-stable-8

1 个答案:

答案 0 :(得分:1)

您需要添加' api'在编译参数的末尾(曾经是' dev')。另外,添加transitive = false的iirc解决了依赖性问题。

dependencies {
    compile ("appeng:appliedenergistics2:${ae_version}:api") {
        transitive = false
    }
}