2023-12-06 22:05:18 +01:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
gradlePluginPortal()
|
|
|
|
|
|
|
|
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
|
|
|
|
maven { url = "https://jitpack.io/" }
|
|
|
|
maven { url = "https://files.minecraftforge.net/maven" }
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
classpath "com.github.johnrengelman:shadow:7.1.2"
|
2024-01-02 17:19:19 +01:00
|
|
|
classpath "net.minecraftforge.gradle:ForgeGradle:6.+"
|
2023-12-06 22:05:18 +01:00
|
|
|
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
|
2024-04-28 21:30:43 +02:00
|
|
|
classpath "me.modmuss50:mod-publish-plugin:0.5.1"
|
2024-06-04 01:33:43 +02:00
|
|
|
classpath "xyz.wagyourtail.jvmdowngrader:gradle-plugin:0.6.1"
|
2023-12-06 22:05:18 +01:00
|
|
|
}
|
2023-10-21 16:08:11 +02:00
|
|
|
}
|
|
|
|
|
2023-12-06 22:05:18 +01:00
|
|
|
allprojects {
|
|
|
|
apply plugin: "java-library"
|
|
|
|
apply plugin: "com.github.johnrengelman.shadow"
|
2024-04-28 21:30:43 +02:00
|
|
|
apply plugin: "me.modmuss50.mod-publish-plugin"
|
2024-06-05 06:40:00 +02:00
|
|
|
apply plugin: "xyz.wagyourtail.jvmdowngrader"
|
|
|
|
|
|
|
|
java {
|
|
|
|
// Minecraft 1.17+ required Java 16/17 to compile
|
|
|
|
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
}
|
|
|
|
|
2023-12-06 22:05:18 +01:00
|
|
|
// We define the configuration here so we can use it across all conventions and platforms
|
|
|
|
// To define which projects/source files should be included in the jar
|
|
|
|
configurations {
|
|
|
|
library
|
|
|
|
implementation.extendsFrom(library)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Repositories for the ViaVersion dependencies defined below
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url = "https://repo.spongepowered.org/repository/maven-public"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
url = "https://repo.viaversion.com"
|
2024-06-04 20:08:53 +02:00
|
|
|
metadataSources {
|
2024-06-05 06:40:00 +02:00
|
|
|
mavenPom()
|
2024-06-04 20:08:53 +02:00
|
|
|
artifact()
|
|
|
|
}
|
2023-12-06 22:05:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replace the version in the mcmod.info and mods.toml files with the project version
|
|
|
|
// Since this depends on the platform version, we can't define it in the global scope :(
|
2024-04-28 21:10:10 +02:00
|
|
|
tasks {
|
|
|
|
processResources {
|
|
|
|
for (final def file in ["mcmod.info", "META-INF/mods.toml"]) {
|
|
|
|
filesMatching(file) {
|
|
|
|
expand "version": project.version
|
|
|
|
}
|
2023-12-06 22:05:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Including all required libraries for ViaVersion {for version numbers see gradle.properties}
|
|
|
|
dependencies {
|
|
|
|
compileOnly "io.netty:netty-all:4.0.20.Final"
|
|
|
|
|
2024-06-05 06:40:00 +02:00
|
|
|
library "com.viaversion:viaversion-common:${project.viaversion_version}"
|
|
|
|
library "com.viaversion:viabackwards-common:${project.viabackwards_version}"
|
|
|
|
library "com.viaversion:viarewind-common:${project.viarewind_version}"
|
|
|
|
library ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
|
2023-12-06 22:05:18 +01:00
|
|
|
exclude group: "com.google.code.gson", module: "gson"
|
|
|
|
}
|
2024-06-05 06:40:00 +02:00
|
|
|
library "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
|
|
|
|
library ("net.raphimc:ViaLoader:${project.vialoader_version}") {
|
2023-12-06 22:05:18 +01:00
|
|
|
exclude group: "com.google.guava"
|
|
|
|
exclude group: "org.slf4j"
|
|
|
|
}
|
|
|
|
|
|
|
|
library "org.yaml:snakeyaml:${project.snake_yml_version}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
apply plugin: "net.minecraftforge.gradle"
|
|
|
|
apply plugin: "org.spongepowered.mixin"
|
|
|
|
|
|
|
|
// Define the jar output attributes for all platforms
|
|
|
|
archivesBaseName = project.maven_name
|
2024-04-28 21:10:10 +02:00
|
|
|
version = maven_version
|
2023-12-06 22:05:18 +01:00
|
|
|
group = maven_group
|
|
|
|
|
2024-02-04 00:46:45 +01:00
|
|
|
// Used to execute code only for specific submodules
|
|
|
|
def versionId = Integer.parseInt(project.mc_version.replace(".", ""))
|
|
|
|
|
2023-12-06 22:05:18 +01:00
|
|
|
compileJava.options.encoding = "UTF-8"
|
|
|
|
|
|
|
|
minecraft {
|
|
|
|
runs {
|
|
|
|
client {
|
|
|
|
workingDirectory project.file("run")
|
|
|
|
|
|
|
|
property "forge.logging.markers", "REGISTRIES"
|
|
|
|
property "forge.logging.console.level", "debug"
|
|
|
|
|
|
|
|
// mixin
|
|
|
|
property "mixin.debug.export", "true"
|
|
|
|
property "mixin.hotSwap", "true"
|
|
|
|
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader" // Only required for MC 1.12, but modern Forges skips this anyway
|
|
|
|
args "-mixin.config=" + "mixins." + project.getProperty('maven_name') + ".json"
|
|
|
|
|
|
|
|
// source set
|
|
|
|
mods {
|
|
|
|
"${project.maven_name}" {
|
|
|
|
source sourceSets.main
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets.main.resources {
|
|
|
|
srcDir "src/generated/resources"
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-04-28 18:54:38 +02:00
|
|
|
if (versionId >= 1_17_1) {
|
2024-02-04 00:46:45 +01:00
|
|
|
// Minecraft 1.17+ already includes slf4j, so we don't need to include it
|
2023-12-06 22:05:18 +01:00
|
|
|
compileOnly "org.slf4j:slf4j-api:${slf4j_version}"
|
|
|
|
} else {
|
|
|
|
library "org.slf4j:slf4j-api:${slf4j_version}"
|
|
|
|
}
|
|
|
|
|
|
|
|
library "org.spongepowered:mixin:${mixin_version}"
|
|
|
|
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
|
|
|
|
|
|
|
|
library project(":") // Include the base project, to get Common-ViaForge
|
|
|
|
}
|
|
|
|
|
|
|
|
mixin {
|
|
|
|
add sourceSets.main, "mixins.${project.maven_name}.refmap.json"
|
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
|
|
|
manifest.attributes(
|
|
|
|
"Specification-Title": "viaforge",
|
|
|
|
"Specification-Vendor": "viaforge",
|
2023-12-08 16:24:17 +01:00
|
|
|
"Specification-Version": project.version,
|
2023-12-06 22:05:18 +01:00
|
|
|
"Implementation-Title": project.name,
|
2023-12-08 16:24:17 +01:00
|
|
|
"Implementation-Version": project.version,
|
2023-12-06 22:05:18 +01:00
|
|
|
"Implementation-Vendor" :"viaforge",
|
|
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
|
|
|
|
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
|
|
|
|
"TweakOrder": "0",
|
|
|
|
"FMLCorePluginContainsFMLMod": "true", // Only required for MC 1.12, but modern Forges skips this anyway
|
|
|
|
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", // Counterpart to the above
|
|
|
|
"MixinConfigs": "mixins.${project.maven_name}.json",
|
|
|
|
"ForceLoadAsMod": "true"
|
|
|
|
)
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2024-06-05 06:40:00 +02:00
|
|
|
shadowJar {
|
2024-04-28 18:54:38 +02:00
|
|
|
if (versionId >= 1_17_1) {
|
2024-06-05 06:40:00 +02:00
|
|
|
archiveFileName = jar.archiveFileName
|
2024-06-05 03:53:57 +02:00
|
|
|
} else {
|
2024-06-05 06:40:00 +02:00
|
|
|
destinationDirectory = temporaryDir
|
2023-12-06 22:05:18 +01:00
|
|
|
}
|
2024-06-04 20:08:53 +02:00
|
|
|
configurations = [project.configurations.library] // Include the dependencies from the include configuration
|
2023-12-06 22:05:18 +01:00
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
|
|
|
|
|
|
// Prevent conflicts with Forge's weird service loading
|
|
|
|
exclude("META-INF/maven/**")
|
|
|
|
exclude("META-INF/versions/**")
|
|
|
|
|
2024-04-28 18:54:38 +02:00
|
|
|
if (versionId >= 1_13_2) {
|
2024-02-04 00:46:45 +01:00
|
|
|
// We don't need to package mixins into Forge 1.13+ jars, since Forge already has it
|
|
|
|
exclude("org/spongepowered/**")
|
|
|
|
}
|
2024-04-28 18:54:38 +02:00
|
|
|
if (versionId >= 1_16_5) {
|
2023-12-06 22:05:18 +01:00
|
|
|
// Get rid of the services folder, since Forge 1.16+ would conflict with some of the ForgeDev Environment's services
|
|
|
|
// And since we don't need them for Mixins anyway, we can just exclude them from the shadowJar
|
|
|
|
exclude("META-INF/services/**")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-05 06:40:00 +02:00
|
|
|
downgradeJar {
|
|
|
|
inputFile = shadowJar.archiveFile
|
|
|
|
destinationDirectory = temporaryDir
|
|
|
|
}
|
|
|
|
|
|
|
|
shadeDowngradedApi {
|
|
|
|
archiveFileName = jar.archiveFileName
|
|
|
|
}
|
|
|
|
|
2024-04-28 21:30:43 +02:00
|
|
|
publishMods {
|
|
|
|
file = shadowJar.archiveFile
|
|
|
|
type = STABLE
|
|
|
|
displayName = rootProject.name + ' ' + project.version
|
|
|
|
version = project.version + "+" + project.mc_version
|
|
|
|
modLoaders.add("forge")
|
|
|
|
changelog = file("../CHANGELOG.md").text
|
|
|
|
dryRun = rootProject.maven_version.contains("SNAPSHOT")
|
|
|
|
|
|
|
|
curseforge {
|
|
|
|
accessToken = providers.gradleProperty("curseforge.publishing_token")
|
|
|
|
projectId = "418933"
|
|
|
|
minecraftVersions.addAll(project.mc_version.split(','))
|
|
|
|
}
|
|
|
|
modrinth {
|
|
|
|
accessToken = providers.gradleProperty("modrinth.publishing_token")
|
|
|
|
projectId = "Z6se2s8f"
|
|
|
|
minecraftVersions.addAll(project.mc_version.split(','))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 22:05:18 +01:00
|
|
|
reobf {
|
|
|
|
shadowJar {}
|
|
|
|
}
|
|
|
|
|
|
|
|
jar.dependsOn("shadowJar")
|
2024-06-05 06:40:00 +02:00
|
|
|
if (versionId < 1_17_1) {
|
|
|
|
// Downgrade the jar to Java 8 for Minecraft 1.16.5 and below
|
|
|
|
jar.dependsOn("shadeDowngradedApi")
|
|
|
|
}
|
|
|
|
}
|