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

Trying to add Applied Energistics api through build.gradle

我开始玩我的世界 mod,但我无法正确 build.gradle。

我想在应用能量学之上创建一个mod但是当我添加这个[=31=时我无法构建它] 作为 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

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

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