【问题标题】:Trying to add Applied Energistics api through build.gradle尝试通过 build.gradle 添加 Applied Energistics api
【发布时间】:2018-02-13 23:27:31
【问题描述】:

我开始使用 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

【问题讨论】:

  • SO 的 [minecraft] 标签非常慢。不幸的是,我不知道发生了什么,但如果您在 Forge forums 上提问,我相信那些更熟悉添加依赖项的人将能够提供帮助。
  • @Draco18s 好的,我会这样做的 :) thx

标签: gradle minecraft minecraft-forge


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2021-04-29
    • 2022-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-17
    • 2018-03-15
    • 1970-01-01
    相关资源
    最近更新 更多