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
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
- }
- }
- 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: 'kotlin'
- apply plugin: 'idea'
- apply plugin: 'eclipse'
- apply plugin: 'maven-publish'
- version = project.minecraft_version + '-' + project.mod_version
- group = project.maven_group
- archivesBaseName = project.archives_base_name
- sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
- println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
- minecraft {
- mappings channel: project.mappings_channel, version: project.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 {
- rubymod {
- 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 {
- rubymod {
- 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', project.modid, '--all', '--output', file('src/generated/resources/'), "--existing", file('src/main/resources/')
- mods {
- rubymod {
- source sourceSets.main
- }
- }
- }
- }
- }
- repositories {
- maven {
- name = 'Kotlin for Forge'
- url = 'https://thedarkcolour.github.io/KotlinForForge/'
- }
- }
- dependencies {
- implementation 'org.jetbrains:annotations:19.0.0'
- minecraft 'net.minecraftforge:forge:' + project.minecraft_version + '-' + project.forge_version
- // Use the latest version of KotlinForForge
- fg.deobf(implementation('thedarkcolour:kotlinforforge:1.6.0'))
- }
- compileKotlin {
- kotlinOptions {
- jvmTarget = '1.8'
- }
- }
- jar {
- manifest {
- attributes([
- "Specification-Title" : project.modid,
- "Specification-Vendor" : project.author,
- "Specification-Version" : "1", // We are version 1 of ourselves
- "Implementation-Title" : project.name,
- "Implementation-Version" : project.version,
- "Implementation-Vendor" : project.author,
- "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
- ])
- }
- }
- // Example configuration to allow publishing using the maven-publish task
- // This is the preferred method to reobfuscate your jar file
- jar.finalizedBy('reobfJar')
- // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
- //publish.dependsOn('reobfJar')
- task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
- }
- build.dependsOn sourcesJar
- artifacts {
- archives sourcesJar
- }
- // Process resources on build
- processResources {
- // This will ensure that this task is redone when the versions change.
- inputs.property 'version', project.version
- // Replace stuff in mods.toml, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'META-INF/mods.toml'
- // Replace version
- expand 'version': project.version
- }
- // Copy everything else except the mods.toml
- from(sourceSets.main.resources.srcDirs) {
- exclude 'META-INF/mods.toml'
- }
- }
- publishing {
- publications {
- mavenJava(MavenPublication) {
- artifact jar
- }
- }
- repositories {
- maven {
- url "file:///${project.projectDir}/mcmodsrepo"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment