Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- buildscript {
- repositories {
- maven { url = 'https://files.minecraftforge.net/maven' }
- jcenter()
- mavenCentral()
- }
- dependencies {
- classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
- }
- }
- apply plugin: 'net.minecraftforge.gradle'
- // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
- apply plugin: 'eclipse'
- apply plugin: 'maven-publish'
- repositories {
- maven { // TOP
- name 'tterrag maven'
- url "https://maven.tterrag.com/"
- }
- maven { // Mantle and JEI
- name 'DVS1 Maven FS'
- url 'https://dvs1.progwml6.com/files/maven'
- }
- maven {
- name "crafttweaker maven"
- url "https://maven.blamejared.com"
- }
- maven {
- name 'davenonymous maven'
- url "http://maven.davenonymous.com/repository/maven-releases"
- }
- maven { // HWYLA, last since it 403s anything not present
- name "Tehnut Maven FS"
- url "https://maven.tehnut.info"
- }
- }
- version = "${mod_version}"
- group = 'com.davenonymous.bonsaitrees2' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
- archivesBaseName = 'bonsaitrees2'
- sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
- minecraft {
- // The mappings can be changed at any time, and must be in the following format.
- // snapshot_YYYYMMDD Snapshot are built nightly.
- // stable_# Stables are built at the discretion of the MCP team.
- // Use non-default mappings at your own risk. they may not always work.
- // Simply re-run your setup task after changing the mappings to update your workspace.
- mappings channel: "snapshot", version: "${mappings_version}"
- // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
- // Default run configurations.
- // These can be tweaked, removed, or duplicated as needed.
- runs {
- client {
- workingDirectory project.file('run')
- // Recommended logging data for a userdev environment
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
- // Recommended logging level for the console
- property 'forge.logging.console.level', 'debug'
- mods {
- bonsaitrees2 {
- source sourceSets.main
- }
- }
- }
- server {
- workingDirectory project.file('run')
- // Recommended logging data for a userdev environment
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
- // Recommended logging level for the console
- property 'forge.logging.console.level', 'debug'
- mods {
- bonsaitrees2 {
- source sourceSets.main
- }
- }
- }
- data {
- workingDirectory project.file('run')
- // Recommended logging data for a userdev environment
- property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
- // Recommended logging level for the console
- property 'forge.logging.console.level', 'debug'
- args '--mod', 'bonsaitrees2', '--all', '--output', file('src/generated/resources/')
- mods {
- bonsaitrees2 {
- source sourceSets.main
- }
- }
- }
- }
- }
- dependencies {
- // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
- // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
- // The userdev artifact is a special name and will get all sorts of transformations applied to it.
- minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
- // compile against the JEI API but do not include it at runtime
- compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
- // at runtime, use the full JEI jar
- runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
- compile fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_version}")
- compile fg.deobf("mcjty.theoneprobe:TheOneProbe-${top_version}") {
- transitive = false
- }
- compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:${crafttweaker_version}")
- if (findProject(':Libnonymous') != null) {
- compile project(':Libnonymous')
- } else {
- compile fg.deobf ("com.davenonymous.libnonymous:libnonymous-1.15.2:${libnonymous_version}:")
- }
- }
- allprojects {
- if (System.getenv("GITHUB_BUILD") != null) {
- version += ".${System.getenv("BUILD_NUMBER")}"
- }
- }
- // Example for how to get properties into the manifest for reading by the runtime..
- jar {
- manifest {
- attributes([
- "Specification-Title": "bonsaitrees2",
- "Specification-Vendor": "Davenonymous",
- "Specification-Version": "1", // We are version 1 of ourselves
- "Implementation-Title": project.name,
- "Implementation-Version": "${version}",
- "Implementation-Vendor" :"Davenonymous",
- "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
- ])
- }
- }
- task sourcesJar(type: Jar) {
- classifier = "sources"
- from sourceSets.main.allJava
- }
- task deobfJar(type: Jar) {
- classifier = "deobf"
- from sourceSets.main.output
- }
- def reobfFile = file("$buildDir/reobfJar/output.jar")
- def reobfArtifact = artifacts.add('default', reobfFile) {
- type 'jar'
- builtBy 'reobfJar'
- }
- publishing {
- publications {
- mavenJava(MavenPublication) {
- artifact reobfArtifact
- artifact sourcesJar
- artifact deobfJar
- }
- }
- repositories {
- maven {
- url "file:///${project.projectDir}/mcmodsrepo"
- }
- maven {
- name = "GitHubPackages"
- url = uri("https://maven.pkg.github.com/thraaawn/BonsaiTrees")
- credentials {
- username = System.getenv("GITHUB_ACTOR")
- password = System.getenv("GITHUB_TOKEN")
- }
- }
- maven {
- name = "davenonymous maven"
- url = uri("http://maven.davenonymous.com/repository/maven-releases")
- credentials {
- username = "davenonymous"
- password = System.getenv("DAVE_MAVEN_PASSWORD")
- }
- }
- }
- }
- import groovy.json.JsonSlurper
- import groovy.json.JsonOutput
- processResources {
- // Minifies all .json files when building the mod.
- // Source files are not minified, only the jar copies.
- doLast {
- def jsonMinifyStart = System.currentTimeMillis()
- def jsonMinified = 0
- def jsonBytesSaved = 0
- fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
- File file = it
- jsonMinified++
- def oldLength = file.length()
- file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
- jsonBytesSaved += oldLength - file.length()
- }
- println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment