Skip to content

Instantly share code, notes, and snippets.

@johnsusek
Created June 24, 2020 15:24
Show Gist options
  • Save johnsusek/87c4965d03b2a2cdc2310a0e05efe628 to your computer and use it in GitHub Desktop.
Save johnsusek/87c4965d03b2a2cdc2310a0e05efe628 to your computer and use it in GitHub Desktop.
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.md-5', name: 'SpecialSource', version: '1.8.6', changing: true
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'java'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.1'
group = 'com.yourname.modidserver'
archivesBaseName = 'modidserver'
allprojects {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
}
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
minecraft {
mappings channel: 'snapshot', version: '20200514-1.15.1'
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', 'info'
mods {
"mverse-server" {
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', 'info'
mods {
"mverse-server" {
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', 'info'
args '--mod', 'mverse-server', '--all', '--output', file('src/generated/resources/')
mods {
"mverse-server" {
source sourceSets.main
}
}
}
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.2.21'
compile 'net.md-5:SpecialSource:1.8.6'
compile 'org.infinispan:infinispan-core:11.0.0.Final'
compile 'com.github.javadev:underscore:1.55'
compile 'org.infinispan.protostream:protostream-processor:4.3.3.Final'
}
jar {
manifest {
attributes([
"Specification-Title": "mverse-server",
"Specification-Vendor": "John Susek",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"John Susek",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
shadowJar {
classifier '' // Replace the default JAR
}
reobf {
shadowJar {} // Reobfuscate the shadowed JAR
}
// 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')
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs.addAll(['-Xlint:unchecked', '-Xlint:deprecation'])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment