Jump to content

[1.12.2] [SOLVED] Adding a mod to the dev environment via build.gradle


Turbo Pig

Recommended Posts

My IDE is Eclipse, if that makes any difference.

 

I've been adding dependent mods to the dev environment by adding the JAR as a library (Build Path > Configure Build Path...).  This has worked fine for most mods.  However, attempting to add Botania in this manner results in a crash, so I have been prompted to add my dependencies through build.gradle.

 

Here is the contents my build.gradle file, using Tinker's Construct as an example:

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 = "0.3"
group = "turbopig.mod.tinkegration"
archivesBaseName = "tinkegration"

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

minecraft {
    version = "1.12.2-14.23.1.2578"
    runDir = "run"
    mappings = "snapshot_20171003"
    makeObfSourceJar = false
}

repositories {
    maven {
        name 'DVS1 Maven FS'
        url 'http://dvs1.progwml6.com/files/maven'
    }
}

dependencies {
    deobfCompile "slimeknights.mantle:Mantle:1.12-1.3.1.22"
    deobfCompile "slimeknights:TConstruct:1.12-2.8.1.51"
}

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'
    }
}

 

Running setupDecompWorkspace seems to download the dependencies, yet I cannot access the mods through my own code.  Specifically, "The import slimeknights cannot be resolved."

I have tried:

  • Deleting the build folder, and running setupDecompWorkspace again
  • Running cleanCache, then setupDecompWorkspace --refresh-dependencies
  • The above two, together

What is going wrong?

 

Thanks

Edited by Turbo Pig
Problem solved
Link to comment
Share on other sites

Drats.  Fortunately I already have IDEA already installed, and it appears to have Gradle support.  Hopefully this fixes the problem, thanks!

 

Quote

Alternatively you must add the dependencies in both places (build.gradleand via the Eclipse GUI).

Interestingly enough, I have found that adding the JARs through the Eclipse GUI was sufficient (albeit, not for Botania... but perhaps that is a different issue).  Correct me if I'm wrong, but I have heard that Forge automatically includes JARs found in the /libs folder.

Based on this, assuming I'm using Gradle-compatible IDE, will I have to include dependencies in the /libs folder as well?  Or is adding the dependencies via build.gradle sufficient?

 

Thanks for your patience, I don't know much about Gradle.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.