Skip to content

Instantly share code, notes, and snippets.

@ocpu
Created August 27, 2017 16:32
Show Gist options
  • Save ocpu/503cdc53680164d492118eac612660f5 to your computer and use it in GitHub Desktop.
Save ocpu/503cdc53680164d492118eac612660f5 to your computer and use it in GitHub Desktop.
Minecraft Forge build.gradle in somewhat detail
buildscript {
repositories {
// Adds the jcenter repository
jcenter()
// Add minecraft forge repositories
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
// Applies the forge plugin
apply plugin: "net.minecraftforge.gradle.forge"
minecraft {
// Any version from http://files.minecraftforge.net
version = "1.12-14.21.1.2387"
// Can be any date (snapshot_YYYYMMDD)
// Can append new Date().format("yyyMMdd") to 'snapshot_' if you always want the current date.
mappings = "snapshot_20170827"
// Where to save configs, game settings, etc.
runDir = "run"
// Obfuscate your class files.
// An Srg named sources jar is made by default.
makeObfSourceJar = false
}
// The group id of your mod.
// With name: com.name.modid
// With domain: domain.my.modid # if the original domain was my.domain
// More info can be found at http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = "com.ocpu.myMod"
// The unique id of your mod.
// Used as artifactId in maven publishing.
archivesBaseName = "myMod"
// The version of your mod.
// It is recommended to use semver but not necessary. http://semver.org/
version = "0.0.0"
// Specify all your dependencies.
// Any jars in './libs' is automatically added
dependencies {
// You define dependencies like this
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// Adds buildcraft to the dev env
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// Adds ejml to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24'
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
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'
// Replaces ${version} and ${mcversion} in mcmod.info
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment