158 lines
4.7 KiB
Groovy
158 lines
4.7 KiB
Groovy
import io.github.ran.jarmerger.JarMergerPlugin
|
|
|
|
buildscript {
|
|
dependencies{
|
|
classpath files('plugins/DHJarMerger-1.0.jar')
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
|
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
|
|
}
|
|
|
|
apply plugin: JarMergerPlugin
|
|
|
|
architectury {
|
|
minecraft = rootProject.minecraft_version
|
|
}
|
|
|
|
subprojects { p ->
|
|
apply plugin: "dev.architectury.loom"
|
|
|
|
loom {
|
|
silentMojangMappingsLicense()
|
|
}
|
|
|
|
configurations {
|
|
common
|
|
shadowMe
|
|
implementation.extendsFrom shadowMe
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
|
// The following line declares the mojmap mappings
|
|
mappings loom.officialMojangMappings()
|
|
|
|
// Toml
|
|
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
|
|
|
if (p != project(":forge")) {
|
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
|
// Do NOT use other classes from fabric loader unless working with fabric
|
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
|
}
|
|
|
|
|
|
if (p != project(":core")) {
|
|
common(project(":core")) { transitive false }
|
|
shadowMe(project(":core")) { transitive false }
|
|
}
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Implementation-Title': rootProject.archives_base_name,
|
|
'Implementation-Version': rootProject.mod_version,
|
|
'Main-Class': 'com.seibel.lod.core.JarMain'
|
|
}
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
apply plugin: "java"
|
|
apply plugin: "architectury-plugin"
|
|
apply plugin: "maven-publish"
|
|
|
|
archivesBaseName = rootProject.archives_base_name
|
|
version = rootProject.mod_version
|
|
group = rootProject.maven_group
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
// used to download and compile dependencies from git repos
|
|
maven { url 'https://jitpack.io' }
|
|
|
|
// Required for importing Modrinth mods
|
|
maven {
|
|
name = "Modrinth"
|
|
url = "https://api.modrinth.com/maven"
|
|
content {
|
|
includeGroup "maven.modrinth"
|
|
}
|
|
}
|
|
|
|
// Required for importing CursedForge mods
|
|
maven {
|
|
url "https://www.cursemaven.com"
|
|
content {
|
|
includeGroup "curse.maven"
|
|
}
|
|
}
|
|
|
|
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
|
flatDir {
|
|
dirs "${rootDir}/mods/fabric"
|
|
content {
|
|
includeGroup "fabric-mod"
|
|
}
|
|
}
|
|
flatDir {
|
|
dirs "${rootDir}/mods/forge"
|
|
content {
|
|
includeGroup "forge-mod"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Put stuff from gradle.properties into the mod info
|
|
processResources {
|
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
|
def replaceProperties = [
|
|
version: mod_version,
|
|
mod_name: mod_name,
|
|
authors: mod_authors,
|
|
description: mod_description,
|
|
homepage: mod_homepage,
|
|
source: mod_source,
|
|
issues: mod_issues
|
|
] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
|
|
|
inputs.properties replaceProperties
|
|
replaceProperties.put 'project', project
|
|
filesMatching(resourceTargets) {
|
|
expand replaceProperties
|
|
}
|
|
|
|
intoTargets.each { target ->
|
|
if (file(target).exists()) {
|
|
copy {
|
|
from(sourceSets.main.resources) {
|
|
include resourceTargets
|
|
expand replaceProperties
|
|
}
|
|
into target
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = "UTF-8"
|
|
|
|
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
|
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
|
// We'll use that if it's available, but otherwise we'll use the older option.
|
|
def targetVersion = 8
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
options.release = targetVersion
|
|
}
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
}
|
|
}
|