Merge branch 'main' of gitlab.com:jeseibel/minecraft-lod-mod
This commit is contained in:
+95
-63
@@ -89,7 +89,7 @@ forgix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subprojects { p ->
|
subprojects { p ->
|
||||||
// Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")"
|
// Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverWeAddLaterOn")"
|
||||||
// Useful later on so we dont have duplicated code
|
// Useful later on so we dont have duplicated code
|
||||||
def isMinecraftSubProject = p != project(":core") && p != project(":api")
|
def isMinecraftSubProject = p != project(":core") && p != project(":api")
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ subprojects { p ->
|
|||||||
|
|
||||||
// set up custom configurations (configurations are a way to handle dependencies)
|
// set up custom configurations (configurations are a way to handle dependencies)
|
||||||
configurations {
|
configurations {
|
||||||
// extends the shadowJar configuration
|
// extends the shadowJar configuration
|
||||||
shadowMe
|
shadowMe
|
||||||
// have implemented dependencies automatically embedded in the final jar
|
// have implemented dependencies automatically embedded in the final jar
|
||||||
implementation.extendsFrom(shadowMe)
|
implementation.extendsFrom(shadowMe)
|
||||||
@@ -156,8 +156,9 @@ subprojects { p ->
|
|||||||
annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}")
|
annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}")
|
||||||
|
|
||||||
// Log4j
|
// Log4j
|
||||||
shadowMe("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}")
|
// TODO: Change to shadowMe later to work in the standalone jar
|
||||||
shadowMe("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}")
|
implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}")
|
||||||
|
implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}")
|
||||||
|
|
||||||
// JOML
|
// JOML
|
||||||
implementation("org.joml:joml:${rootProject.joml_version}")
|
implementation("org.joml:joml:${rootProject.joml_version}")
|
||||||
@@ -268,6 +269,77 @@ subprojects { p ->
|
|||||||
jar.dependsOn(shadowJar)
|
jar.dependsOn(shadowJar)
|
||||||
|
|
||||||
|
|
||||||
|
// Put stuff from gradle.properties into the mod info
|
||||||
|
processResources {
|
||||||
|
def resourceTargets = [ // Location of where to inject the properties
|
||||||
|
// Properties for each of the loaders
|
||||||
|
"fabric.mod.json",
|
||||||
|
"quilt.mod.json",
|
||||||
|
"META-INF/mods.toml",
|
||||||
|
|
||||||
|
// The mixins for each of the loaders
|
||||||
|
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||||
|
]
|
||||||
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
|
|
||||||
|
// Fix forge version numbering system as it is weird
|
||||||
|
// For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] which make more sense
|
||||||
|
def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)")
|
||||||
|
// println compatible_forgemc_versions
|
||||||
|
|
||||||
|
// Quilt's custom contributors system
|
||||||
|
// This has to be like
|
||||||
|
// "Person": "Developer", "Another person": "Developer"
|
||||||
|
def quilt_contributors = []
|
||||||
|
def mod_author_list = mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",")
|
||||||
|
for (dev in mod_author_list) {
|
||||||
|
quilt_contributors.push("\"${dev.strip()}\": \"Developer\"")
|
||||||
|
}
|
||||||
|
quilt_contributors.reverse()
|
||||||
|
// println quilt_contributors.join(", ")
|
||||||
|
|
||||||
|
// TODOI: Find something we can use so we can basically re-map only when the jar is shadowed and relocated
|
||||||
|
// println p.tasks.findByName('shadowJar')
|
||||||
|
|
||||||
|
|
||||||
|
def replaceProperties = [
|
||||||
|
version : mod_version,
|
||||||
|
mod_name : mod_readable_name,
|
||||||
|
group : maven_group,
|
||||||
|
authors : mod_authors,
|
||||||
|
description : mod_description,
|
||||||
|
homepage : mod_homepage,
|
||||||
|
source : mod_source,
|
||||||
|
issues : mod_issues,
|
||||||
|
discord : mod_discord,
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
|
compatible_forgemc_versions : compatible_forgemc_versions,
|
||||||
|
java_version : java_version,
|
||||||
|
quilt_contributors : "{"+quilt_contributors.join(", ")+"}"
|
||||||
|
]
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Adds the standalone jar's entrypoint
|
// Adds the standalone jar's entrypoint
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE.txt"
|
from "LICENSE.txt"
|
||||||
@@ -421,68 +493,17 @@ allprojects { p ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Put stuff from gradle.properties into the mod info
|
task copyCommonLoaderResources(type: Copy) {
|
||||||
processResources {
|
|
||||||
def resourceTargets = ["fabric.mod.json", "quilt.mod.json", "META-INF/mods.toml"] // Location of where to inject the properties
|
|
||||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
|
||||||
|
|
||||||
// Fix forge version numbering system as it is weird
|
|
||||||
// For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"] which make more sense
|
|
||||||
def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)")
|
|
||||||
// println compatible_forgemc_versions
|
|
||||||
|
|
||||||
// Quilt's custom contributors system
|
|
||||||
// This has to be like
|
|
||||||
// "Person": "Developer", "Another person": "Developer"
|
|
||||||
def quilt_contributors = []
|
|
||||||
def mod_author_list = mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",")
|
|
||||||
for (dev in mod_author_list) {
|
|
||||||
quilt_contributors.push("\"${dev.strip()}\": \"Developer\"")
|
|
||||||
}
|
|
||||||
quilt_contributors.reverse()
|
|
||||||
// println quilt_contributors.join(", ")
|
|
||||||
|
|
||||||
def replaceProperties = [
|
|
||||||
version : mod_version,
|
|
||||||
mod_name : mod_readable_name,
|
|
||||||
group : maven_group,
|
|
||||||
authors : mod_authors,
|
|
||||||
description : mod_description,
|
|
||||||
homepage : mod_homepage,
|
|
||||||
source : mod_source,
|
|
||||||
issues : mod_issues,
|
|
||||||
discord : mod_discord,
|
|
||||||
minecraft_version : minecraft_version,
|
|
||||||
compatible_minecraft_versions: compatible_minecraft_versions,
|
|
||||||
compatible_forgemc_versions : compatible_forgemc_versions,
|
|
||||||
java_version : java_version,
|
|
||||||
quilt_contributors : "{"+quilt_contributors.join(", ")+"}"
|
|
||||||
]
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyAccessWidener(type: Copy) {
|
|
||||||
from project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener")
|
from project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener")
|
||||||
into(file(p.file("build/resources/main")))
|
into(file(p.file("build/resources/main")))
|
||||||
rename "${accessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
rename "${accessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
|
||||||
|
// Move the fabricLike mixin to its different places for each subproject
|
||||||
|
if (findProject(":fabricLike")) {
|
||||||
|
from project(":fabricLike").file("src/main/resources/DistantHorizons.fabricLike.mixins.json")
|
||||||
|
into(file(p.file("build/resources/main")))
|
||||||
|
rename "DistantHorizons.fabricLike.mixins.json", "DistantHorizons." + p.name + ".fabricLike.mixins.json"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyCoreResources(type: Copy) {
|
task copyCoreResources(type: Copy) {
|
||||||
@@ -490,6 +511,17 @@ allprojects { p ->
|
|||||||
into p.file("build/resources/main")
|
into p.file("build/resources/main")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This method doesnt seem to actually remove it from the jar, probably called at incorrect spots
|
||||||
|
task deleteDuplicatedCommonLoaderResources(type: Delete) {
|
||||||
|
// Delete the duplicated fabricLike.mixins.json
|
||||||
|
delete p.file("build/resources/main/DistantHorizons.fabricLike.mixins.json")
|
||||||
|
|
||||||
|
// Delete all the duplicated accesswideners
|
||||||
|
delete fileTree(p.file("build/resources/main")) {
|
||||||
|
include "*.lod.accesswidener"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
if (isMinecraftSubProject) {
|
if (isMinecraftSubProject) {
|
||||||
options.release = rootProject.java_version as Integer
|
options.release = rootProject.java_version as Integer
|
||||||
|
|||||||
+4
-2
@@ -115,12 +115,14 @@ task deleteResources(type: Delete) {
|
|||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyAccessWidener)
|
dependsOn(copyCommonLoaderResources)
|
||||||
|
dependsOn(deleteDuplicatedCommonLoaderResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
runClient {
|
runClient {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyAccessWidener)
|
dependsOn(copyCommonLoaderResources)
|
||||||
|
dependsOn(deleteDuplicatedCommonLoaderResources)
|
||||||
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
||||||
finalizedBy(deleteResources)
|
finalizedBy(deleteResources)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"DistantHorizons.fabricLike.mixins.json",
|
"DistantHorizons.fabric.fabricLike.mixins.json",
|
||||||
"DistantHorizons.fabric.mixins.json"
|
"DistantHorizons.fabric.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -134,7 +134,8 @@ dependencies {
|
|||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyAccessWidener)
|
dependsOn(copyCommonLoaderResources)
|
||||||
|
dependsOn(deleteDuplicatedCommonLoaderResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
//remapJar {
|
//remapJar {
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.quiltmc.loom" version "0.12.+"
|
id "org.quiltmc.loom" version "1.1.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@@ -54,7 +54,7 @@ dependencies {
|
|||||||
|
|
||||||
// Quilted Fabric API
|
// Quilted Fabric API
|
||||||
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilted_api_version}" // For now until quilt has a better way of doing this, just use quilt's qfapi
|
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilted_api_version}" // For now until quilt has a better way of doing this, just use quilt's qfapi
|
||||||
// addModJar(fabricApi.module("fabric-events-interaction-v0", rootProject.quilted_api_version))
|
// addModJar(fabricApi.module("fabric-events-interaction-v0" , rootProject.quilted_api_version))
|
||||||
// addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.quilted_api_version))
|
// addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.quilted_api_version))
|
||||||
// addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.quilted_api_version))
|
// addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.quilted_api_version))
|
||||||
// addModJar(fabricApi.module("fabric-resource-loader-v0", rootProject.quilted_api_version))
|
// addModJar(fabricApi.module("fabric-resource-loader-v0", rootProject.quilted_api_version))
|
||||||
@@ -92,12 +92,14 @@ task deleteResources(type: Delete) {
|
|||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyAccessWidener)
|
dependsOn(copyCommonLoaderResources)
|
||||||
|
dependsOn(deleteDuplicatedCommonLoaderResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
runClient {
|
runClient {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyAccessWidener)
|
dependsOn(copyCommonLoaderResources)
|
||||||
|
dependsOn(deleteDuplicatedCommonLoaderResources)
|
||||||
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
||||||
finalizedBy(deleteResources)
|
finalizedBy(deleteResources)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
},
|
},
|
||||||
"access_widener": "lod.accesswidener",
|
"access_widener": "lod.accesswidener",
|
||||||
|
|
||||||
"mixins": [
|
"mixin": [
|
||||||
"DistantHorizons.fabricLike.mixins.json",
|
"DistantHorizons.quilt.fabricLike.mixins.json",
|
||||||
"DistantHorizons.quilt.mixins.json"
|
"DistantHorizons.quilt.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ fabric_api_version=0.67.1+1.18.2
|
|||||||
enable_bclib=1
|
enable_bclib=1
|
||||||
enable_canvas=0
|
enable_canvas=0
|
||||||
|
|
||||||
quilt_loader_version=0.18.4-pre.1-SNAPSHOT
|
quilt_loader_version=0.19.0-beta.13
|
||||||
quilted_api_version=1.0.0-beta.9+0.51.1-1.18.2-SNAPSHOT
|
quilted_api_version=1.0.0-beta.28+0.67.0-1.18.2
|
||||||
# Quilt mod versions
|
# Quilt mod versions
|
||||||
### Most of the time quilt uses the same stuff as fabric, so this is empty atm ###
|
### Most of the time quilt uses the same stuff as fabric, so this is empty atm ###
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user