2023-01-24 01:07:30 +01:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
maven { url = 'https://maven.minecraftforge.net' }
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
2023-02-01 20:30:37 +01:00
|
|
|
classpath "com.palantir.gradle.gitversion:gradle-git-version:0.13.0"
|
2023-01-24 01:07:30 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-01 21:53:08 +01:00
|
|
|
|
2023-01-24 01:07:30 +01:00
|
|
|
apply plugin: 'net.minecraftforge.gradle'
|
|
|
|
apply plugin: 'eclipse'
|
|
|
|
apply plugin: 'maven-publish'
|
2023-01-31 23:02:27 +01:00
|
|
|
apply plugin: "com.palantir.git-version"
|
2023-01-24 01:07:30 +01:00
|
|
|
|
2023-02-01 21:53:08 +01:00
|
|
|
version = gitVersion()
|
|
|
|
group = 'co.fantabos.bscv'
|
2023-01-24 01:07:30 +01:00
|
|
|
archivesBaseName = 'boscovicino'
|
2023-02-01 21:53:08 +01:00
|
|
|
minecraftVersion = '1.16.5'
|
2023-01-24 01:07:30 +01:00
|
|
|
|
2023-02-01 20:53:23 +01:00
|
|
|
project.ext {
|
|
|
|
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.39")
|
|
|
|
copyJarDo = getProjectProperty("copyjar.do", "false")
|
|
|
|
copyJarUseVersionSubDir = getProjectProperty("copyjar.useVersionSubDir", "false")
|
|
|
|
copyJarKeepBackups = getProjectProperty("copyjar.keepBackups", "true")
|
|
|
|
copyJarTargetGameDir = getProjectProperty("copyjar.targetGameDir", getOsGameDir())
|
|
|
|
}
|
|
|
|
|
|
|
|
def getProjectProperty(String property, String fallback) { //allows for custom gradle.properties while retaining default fallback values
|
|
|
|
return (project.hasProperty(property)) ? project.property(property) : fallback
|
|
|
|
}
|
|
|
|
|
|
|
|
def getOsGameDir() {
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows())
|
|
|
|
return System.getenv("APPDATA") + "/.minecraft"
|
|
|
|
else if (org.gradle.internal.os.OperatingSystem.current().isMacOsX())
|
|
|
|
return System.properties["user.home"] + "/Library/Application Support/minecraft"
|
|
|
|
else
|
|
|
|
return System.properties["user.home"] + "/.minecraft"
|
|
|
|
}
|
|
|
|
|
2023-01-24 01:07:30 +01:00
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
|
|
|
|
|
|
|
|
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
2023-02-01 20:53:23 +01:00
|
|
|
|
2023-01-24 01:07:30 +01:00
|
|
|
minecraft {
|
2023-02-01 21:53:08 +01:00
|
|
|
mappings channel: 'official', version: minecraftVersion
|
2023-01-24 01:07:30 +01:00
|
|
|
runs {
|
|
|
|
client {
|
|
|
|
workingDirectory project.file('run')
|
|
|
|
|
|
|
|
// Recommended logging data for a userdev environment
|
|
|
|
// The markers can be changed as needed.
|
|
|
|
// "SCAN": For mods scan.
|
|
|
|
// "REGISTRIES": For firing of registry events.
|
|
|
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
|
|
property 'forge.logging.markers', 'REGISTRIES'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
|
|
|
|
mods {
|
|
|
|
bscv {
|
|
|
|
source sourceSets.main
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data {
|
|
|
|
workingDirectory project.file('run')
|
|
|
|
|
|
|
|
// "SCAN": For mods scan.
|
|
|
|
// "REGISTRIES": For firing of registry events.
|
|
|
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
|
|
property 'forge.logging.markers', 'REGISTRIES'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
|
|
|
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
|
|
|
args '--mod', 'bsvc', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
|
|
|
|
|
|
|
mods {
|
|
|
|
bscv {
|
|
|
|
source sourceSets.main
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Include resources generated by data generators.
|
|
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
|
|
|
|
dependencies {
|
2023-02-01 20:53:23 +01:00
|
|
|
minecraft "net.minecraftforge:forge:${project.ext.forgeVersion}"
|
2023-01-24 01:07:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2023-01-31 23:02:27 +01:00
|
|
|
archiveName = "${jar.baseName}.${jar.extension}"
|
2023-01-24 01:07:30 +01:00
|
|
|
manifest {
|
|
|
|
attributes([
|
|
|
|
"Specification-Title": "bscv",
|
|
|
|
"Specification-Vendor": "ftbsc",
|
|
|
|
"Specification-Version": "1", // We are version 1 of ourselves
|
|
|
|
"Implementation-Title": project.name,
|
|
|
|
"Implementation-Version": "${version}",
|
|
|
|
"Implementation-Vendor" :"ftbsc",
|
|
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-01 20:53:23 +01:00
|
|
|
jar.finalizedBy('reobfJar')
|
|
|
|
|
|
|
|
tasks.register('copyJar', Copy) {
|
|
|
|
if(!project.ext.copyJarDo.toBoolean()) return
|
|
|
|
def modDir = "${project.ext.copyJarTargetGameDir}/mods/"
|
|
|
|
|
|
|
|
// find previous jar (if it exists)
|
|
|
|
final previousJars = project.fileTree(dir: modDir).matching {
|
|
|
|
include project.archivesBaseName + '*'
|
|
|
|
}.files
|
|
|
|
|
2023-02-01 21:53:08 +01:00
|
|
|
previousJars
|
|
|
|
.stream()
|
|
|
|
.filter(f -> f.toString().toLowerCase().endsWith("jar")) //dont kill old backups but smite existing jars
|
|
|
|
.forEach(f -> f.delete())
|
2023-02-01 20:53:23 +01:00
|
|
|
|
|
|
|
//copy jar from build/libs to the forge mod folder
|
|
|
|
//from shadowJar //we want the über version, not the small one
|
2023-02-01 21:09:45 +01:00
|
|
|
from project.jar
|
2023-02-01 20:53:23 +01:00
|
|
|
into modDir
|
|
|
|
}
|
2023-01-24 01:07:30 +01:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
artifact jar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "file:///${project.projectDir}/mcmodsrepo"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-01 21:09:45 +01:00
|
|
|
|
|
|
|
build {
|
|
|
|
//dependsOn shadowJar, reobfShadowJar
|
|
|
|
finalizedBy copyJar
|
2023-02-01 21:53:08 +01:00
|
|
|
}
|