From 4fe24abc51756c0692e7358c2c6eb5def1654145 Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 14 Nov 2022 21:51:09 +1030 Subject: [PATCH 01/12] Save commit for new build system --- .gitignore | 3 - build.gradle | 232 +++++++----------- buildAll | 24 +- buildAll.bat | 35 ++- common/build.gradle | 20 +- .../main/resources/architectury.common.json | 3 - fabric/build.gradle | 43 ++-- fabric/src/main/resources/fabric.mod.json | 2 +- forge/build.gradle | 109 +++++--- gradle.properties | 18 +- settings.gradle | 46 ++-- .../1.16.5.properties | 3 +- .../1.17.1.properties | 3 +- .../1.18.1.properties | 3 +- .../1.18.2.properties | 5 +- .../1.19.2.properties | 3 + .../1.19.properties | 7 +- 17 files changed, 287 insertions(+), 272 deletions(-) delete mode 100644 common/src/main/resources/architectury.common.json rename 1.16.5.properties => versionProperties/1.16.5.properties (95%) rename 1.17.1.properties => versionProperties/1.17.1.properties (95%) rename 1.18.1.properties => versionProperties/1.18.1.properties (95%) rename 1.18.2.properties => versionProperties/1.18.2.properties (95%) rename 1.19.2.properties => versionProperties/1.19.2.properties (94%) rename 1.19.properties => versionProperties/1.19.properties (94%) diff --git a/.gitignore b/.gitignore index 9a08cc7ad..b6f0d8f7a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,3 @@ Merged/ # file genearated via MC version switching using preprocessor build.properties - -# This accesswidener is generated at runtime ant not needed -common/src/main/resources/lod.accesswidener diff --git a/build.gradle b/build.gradle index c3eb4f95c..ddcc09a26 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,17 @@ plugins { - // Plugin to help in developing multi-loader mods - id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false + id "java" // Plugin to handle dependencies - id 'com.github.johnrengelman.shadow' version '7.0.0' apply false + id "com.github.johnrengelman.shadow" version '7.0.0' apply false // Plugin to create merged jars id "io.github.pacifistmc.forgix" version "1.2.6" + // Manifold preprocessor + id 'systems.manifold.manifold-gradle-plugin' version '0.0.2-alpha' + // Provides mc libraries to core - id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply false +// id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false } /** @@ -20,10 +21,10 @@ plugins { * @param mcIndex array index of the currently active MC version */ def writeBuildGradlePredefine(List mcVers, int mcIndex) { - ArrayList redefineList = new ArrayList() + for (int i=0; i mcVers, int mcIndex) { } } - // build the list of preprocessors to use + // Build the list of preprocessors to use StringBuilder sb = new StringBuilder() - // check if this is a development build + sb.append("# DON'T TOUCH THIS FILE, This is handled by the build script\n") + + // Check if this is a development build if (mod_version.toLowerCase().contains("dev")) { // WARNING: only use this for logging, we don't want to have confusion // when a method doesn't work correctly in the release build. @@ -46,7 +49,7 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) { sb.append("=\n") } - // build the MC version preprocessors + // Build the MC version preprocessors for (String redefinedVersion : redefineList) { sb.append(redefinedVersion) sb.append("=\n") @@ -56,71 +59,46 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) { // Sets up the variables for Manifold in the code def loadProperties() { - def defaultMcVersion = "1.19.2" -// def defaultMcVersion = "1.19" // For now use 1.18.2 as default until 1.19 is done + def defaultMcVersion = "1.18.2" // 1.18.2 is our current most stable version so we use that if no version was defined + def mcVersion = "" - def mcVers = mcVersions.split(",") + def mcVers = fileTree("versionProperties").files.name // Get all the files in "versionProperties" + for (int i = 0; i < mcVers.size(); i++) { + mcVers[i] = mcVers[i].replaceAll(".properties", "") // As we are getting the file names, we should remove the ".properties" at the end to get the versions + } int mcIndex = -1 - println "Avalible MC versions: ${mcVersions}" + println "Avalible MC versions: ${mcVers}" if (project.hasProperty("mcVer")) { mcVersion = mcVer - mcIndex = Arrays.asList(mcVers).indexOf(mcVer) + mcIndex = mcVers.indexOf(mcVer) } if (mcIndex == -1) { println "No mcVer set or the set mcVer is invalid! Defaulting to ${defaultMcVersion}." - println "Tip: Use -PmcVer='${defaultMcVersion}' in cmd arg to set mcVer." + println "Tip: Use -PmcVer=\"${defaultMcVersion}\" in cmd arg to set mcVer." mcVersion = defaultMcVersion - mcIndex = Arrays.asList(mcVers).indexOf(defaultMcVersion) + mcIndex = mcVers.indexOf(defaultMcVersion) assert mcIndex != -1 } println "Loading properties file at " + mcVersion + ".properties" def props = new Properties() - props.load(new FileInputStream("$rootProject.rootDir/"+"$mcVersion"+".properties")) + props.load(new FileInputStream("$rootProject.rootDir/versionProperties/"+"$mcVersion"+".properties")) props.each { prop -> rootProject.ext.set(prop.key, prop.value) // println "Added prop [key:" + prop.key + ", value:" + prop.value + "]" } - writeBuildGradlePredefine(Arrays.asList(mcVers), mcIndex) - - // Stuff for access wideners - def mcVersionToAcsessWidenerVersion = [ - "1.16.5": "1_16", - "1.17.1": "1_17", - "1.18.1": "1_18", - "1.18.2": "1_18", - "1.19": "1_19", - "1.19.1": "1_19", - "1.19.2": "1_19" - ] - // Use this as sometimes multiple versions use the same access wideners - rootProject.ext.set("accessWidenerVersion", mcVersionToAcsessWidenerVersion.get(mcVersion)) + writeBuildGradlePredefine(mcVers, mcIndex) } + loadProperties() -// Sets up the accesswideners -def makeAccessWidener() { - def accessWidenerFile = project(":common").file("src/main/resources/lod.accesswidener") - if (accessWidenerFile.exists()) { - delete accessWidenerFile - } - - copy { - from project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener") - into project(":common").file("src/main/resources/") - rename "${rootProject.accessWidenerVersion}.lod.accesswidener", "lod.accesswidener" - } -} -makeAccessWidener() - -// Sets up the version string +// Sets up the version string (the name we use for our jar) rootProject.versionStr = rootProject.mod_version + "-" + rootProject.minecraft_version // + "-" + new Date().format("yyyy_MM_dd_HH_mm") - -// Merged jar settings +// Forgix settings (used for merging jars) forgix { group = "com.seibel.lod" mergedJarName = "DistantHorizons-${rootProject.versionStr}.jar" @@ -137,26 +115,17 @@ forgix { removeDuplicate "com.seibel.lod.core" } -architectury { - minecraft = rootProject.minecraft_version -} subprojects { p -> - - // setup Architectury - if (p == project(":core") || p == project(":api")) { + // Apply plugins + apply plugin: "java" + apply plugin: "com.github.johnrengelman.shadow" +// apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries + if (p == project(":core")) { apply plugin: "application" - apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries - apply plugin: "com.github.johnrengelman.shadow" - } else { - apply plugin: "com.github.johnrengelman.shadow" - apply plugin: "dev.architectury.loom" - - loom { - silentMojangMappingsLicense() - } } + // set up custom configurations (configurations are a way to handle dependencies) configurations { // extends the shadowJar configuration @@ -166,23 +135,27 @@ subprojects { p -> customModule implementation.extendsFrom(customModule) - } - - // Set up the minecraft non-dependency for core sub-projects - if (p == project(":core") || p == project(":api")) { - minecraft { - version("${rootProject.minecraft_version}") - } - // Set the standalone jar entrypoint - // (This will point to a non-existent class in all sub-projects except "Core") + if (p == project(":fabric") /* || p == project(":quilt") */ || p == project(":forge")) { + // Shadow common + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentForge.extendsFrom common + } + } + + + // Set the standalone jar entrypoint + // (This will point to a non-existent class in all sub-projects except "Core") + if (p == project(":core")) { application { mainClass.set('com.seibel.lod.core.jar.JarMain') } } dependencies { - //=====================// // shared dependencies // //=====================// @@ -217,29 +190,6 @@ subprojects { p -> // conditional dependencies // //==========================// - // The logic for buildForge can be made more succinct, but the readability goes way down. - def buildForge = true - if (gradle.startParameter.taskRequests.size() > 0) { - if (gradle.startParameter.taskRequests[0].args.size() > 0) { - if (gradle.startParameter.taskRequests[0].args[0].startsWith("fabric:")) { - buildForge = false - } - } - } - - // Minecraft dependent sub-projects - if (p == project(":common") || (buildForge && p == project(":forge")) || p == project(":fabric")) { - // Add Minecraft - minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - // The following line declares the mojmap mappings & parchment mappings - mappings loom.layered() { - // Mojmap mappings - officialMojangMappings() - // Parchment mappings (it adds parameter mappings & javadoc) - parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip") - } - } - // Add core if (p != project(":api") && p != project(":core")) { implementation(project(":core")) { @@ -261,10 +211,10 @@ subprojects { p -> } } - // Allows the jar to run standalone + // Adds the standalone jar's entrypoint jar { manifest { - attributes 'Implementation-Title': rootProject.archives_base_name, + attributes 'Implementation-Title': rootProject.mod_name, 'Implementation-Version': rootProject.mod_version, 'Main-Class': 'com.seibel.lod.core.jar.JarMain' // When changing the main of the jar change this line } @@ -286,7 +236,7 @@ subprojects { p -> // } // Run mergeJars when running build - if (p != project(":api") && p != project(":api")) { + if (p != project(":api") && p != project(":core")) { build.finalizedBy(mergeJars) assemble.finalizedBy(mergeJars) } @@ -294,10 +244,9 @@ subprojects { p -> allprojects { p -> apply plugin: "java" - apply plugin: "architectury-plugin" apply plugin: "maven-publish" - archivesBaseName = rootProject.archives_base_name + archivesBaseName = rootProject.mod_name version = rootProject.mod_version group = rootProject.maven_group @@ -308,13 +257,13 @@ allprojects { p -> maven { url "https://maven.parchmentmc.org" } // For Architectury API - maven { url "https://maven.architectury.dev" } +// maven { url "https://maven.architectury.dev" } - // used to download and compile dependencies from git repos - maven { url 'https://jitpack.io' } + // For Git repositories + maven { url "https://jitpack.io" } // For Manifold Preprocessor - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } // Required for importing Modrinth mods maven { @@ -339,7 +288,7 @@ allprojects { p -> // Required for Mixins & VanillaGradle maven { url "https://repo.spongepowered.org/maven/" } - // Required for canvas + // Required for Canvas (mod) maven { url "https://maven.vram.io/" } // These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource @@ -359,48 +308,51 @@ allprojects { p -> // Only uncomment this when testing stuff with lwjgl in the core jar -// if (p == project(":core")) { -// dependencies { -// project.ext.lwjglNatives = "natives-linux" -// -// implementation platform("org.lwjgl:lwjgl-bom:3.3.0") -// -// implementation "org.lwjgl:lwjgl" -// implementation "org.lwjgl:lwjgl-assimp" -// implementation "org.lwjgl:lwjgl-glfw" -// implementation "org.lwjgl:lwjgl-openal" -// implementation "org.lwjgl:lwjgl-opengl" -// implementation "org.lwjgl:lwjgl-stb" -// implementation "org.lwjgl:lwjgl-tinyfd" -// runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" -// runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" -// implementation "org.joml:joml:1.10.2" -// } -// } + /* + if (p == project(":core")) { + dependencies { + project.ext.lwjglNatives = "natives-linux" + + implementation platform("org.lwjgl:lwjgl-bom:3.3.0") + + implementation "org.lwjgl:lwjgl" + implementation "org.lwjgl:lwjgl-assimp" + implementation "org.lwjgl:lwjgl-glfw" + implementation "org.lwjgl:lwjgl-openal" + implementation "org.lwjgl:lwjgl-opengl" + implementation "org.lwjgl:lwjgl-stb" + implementation "org.lwjgl:lwjgl-tinyfd" + runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" + implementation "org.joml:joml:1.10.2" + } + } + */ // 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 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 def replaceProperties = [ version : mod_version, - mod_name : mod_name, + mod_name : mod_readable_name, 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, java_version : java_version ] // 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 - //TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)" + //TODO: Make Forge loader version also be replaced with non hardcoded value instead of "[36,42)" inputs.properties replaceProperties replaceProperties.put 'project', project @@ -421,6 +373,12 @@ allprojects { p -> } } + task copyAccessWidener(type: Copy) { + from project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener") + into(file(p.file("build/resources/main"))) + rename "${accessWidenerVersion}.lod.accesswidener", "lod.accesswidener" + } + task copyCoreResources(type: Copy) { from fileTree(project(":core").file("src/main/resources")) into p.file("build/resources/main") @@ -441,12 +399,6 @@ allprojects { p -> java { withSourcesJar() } - - // Disable running common - if (p == project(":common")) { - runClient.enabled = false - runServer.enabled = false - } } // Delete the merged folder when running clean diff --git a/buildAll b/buildAll index ba86063fc..fc042cb76 100755 --- a/buildAll +++ b/buildAll @@ -1,13 +1,15 @@ -#!/usr/bin/env sh +#!/bin/sh -buildVersion() -{ - ./gradlew clean -PmcVer=$1 --no-daemon - ./gradlew build -PmcVer=$1 --no-daemon -} +# Loop trough everything in the version properties folder +for d in versionProperties/*; do + # Get the name of the version that is going to be compiled + version=$(echo "$d" | sed "s/versionProperties\///" | sed "s/.properties//") -buildVersion 1.19 -buildVersion 1.18.2 -buildVersion 1.18.1 -buildVersion 1.17.1 -buildVersion 1.16.5 + # Clean out the folders and build it + # (We could use "./" to run gradlew, but as it is a shell script im going to be running it with the "sh" command) + echo "Cleaning workspace to build $version" + sh gradlew clean -PmcVer=$version --no-daemon | true + echo "Building $version" + sh gradlew build -PmcVer=$version --no-daemon | true + # The "| true" at the end of those 2 are just to make sure the script continues even if a build fails +done diff --git a/buildAll.bat b/buildAll.bat index c5d06ee5d..9affd3a91 100644 --- a/buildAll.bat +++ b/buildAll.bat @@ -1,16 +1,25 @@ @echo off -SETLOCAL -CALL :buildVersion "1.19" -CALL :buildVersion "1.18.2" -CALL :buildVersion "1.18.1" -CALL :buildVersion "1.17.1" -CALL :buildVersion "1.16.5" -EXIT /B %ERRORLEVEL% +echo Windows build all script needs to be rewritten +echo I dont use Windows so I cant really make this +echo So if someone does use Windows and knows how to script stuff then can you please port the "buildall" script I made for Unix -:buildVersion -@echo on -call ./gradlew.bat clean -PmcVer="%~1" --no-daemon -call ./gradlew.bat build -PmcVer="%~1" --no-daemon -@echo off -EXIT /B 0 + + + +@REM Old BAT script if you need some help with this task + +@REM SETLOCAL +@REM CALL :buildVersion "1.19" +@REM CALL :buildVersion "1.18.2" +@REM CALL :buildVersion "1.18.1" +@REM CALL :buildVersion "1.17.1" +@REM CALL :buildVersion "1.16.5" +@REM EXIT /B %ERRORLEVEL% +@REM +@REM :buildVersion +@REM @echo on +@REM call ./gradlew.bat clean -PmcVer="%~1" --no-daemon +@REM call ./gradlew.bat build -PmcVer="%~1" --no-daemon +@REM @echo off +@REM EXIT /B 0 diff --git a/common/build.gradle b/common/build.gradle index 7d345402c..9d87530b4 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,27 +1,23 @@ -architectury { - common(rootProject.enabled_platforms.split(",")) +plugins { + id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' } -loom { - accessWidenerPath = file("src/main/resources/lod.accesswidener") +minecraft { + accessWideners(project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener")) + version(rootProject.minecraft_version) } dependencies { // 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 - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - - if (minecraft_version == "1.16.5") { - modApi("me.shedaniel:architectury:${rootProject.architectury_version}") - } else { - modApi("dev.architectury:architectury:${rootProject.architectury_version}") - } +// modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" } + publishing { publications { mavenCommon(MavenPublication) { - artifactId = rootProject.archives_base_name + artifactId = rootProject.mod_readable_name from components.java } } diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json deleted file mode 100644 index a37cd6679..000000000 --- a/common/src/main/resources/architectury.common.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "accessWidener": "lod.accesswidener" -} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 6d90651aa..bed5b641d 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,21 +1,26 @@ -version = rootProject.versionStr - -architectury { - platformSetupLoomIde() - fabric() +plugins { + id "fabric-loom" version "0.12-SNAPSHOT" } loom { - accessWidenerPath = project(":common").loom.accessWidenerPath + accessWidenerPath = project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener") + runs { + client { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + runDir("run") + } + server { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + runDir("run") + } + } } configurations { - common - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentFabric.extendsFrom common - // The addModJar basically embeds the mod to the built jar addModJar include.extendsFrom addModJar @@ -30,9 +35,19 @@ def addMod(path, enabled) { } dependencies { + minecraft "com.mojang:minecraft:${minecraft_version}" + mappings loom.layered() { + // Mojmap mappings + officialMojangMappings() + // Parchment mappings (it adds parameter mappings & javadoc) + parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip") + } // Fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + // Common + implementation project(":common") + // Architectury API if (minecraft_version == "1.16.5") { addModJar("me.shedaniel:architectury-fabric:${rootProject.architectury_version}") @@ -98,8 +113,6 @@ dependencies { } shadowJar { - exclude "architectury.common.json" - configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] // Compression @@ -132,10 +145,12 @@ task deleteResources(type: Delete) { processResources { dependsOn(copyCoreResources) + dependsOn(copyAccessWidener) } runClient { dependsOn(copyCoreResources) + dependsOn(copyAccessWidener) jvmArgs "-XX:-OmitStackTraceInFastThrow" finalizedBy(deleteResources) } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b63bf5f28..b4e3935db 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -48,7 +48,7 @@ "custom": { "modmenu": { "links": { - "modmenu.discord": "https://discord.gg/xAB8G4cENx" + "modmenu.discord": "${discord}" } } } diff --git a/forge/build.gradle b/forge/build.gradle index 0d592b9bc..0fcc0db8c 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,52 +1,92 @@ -version = rootProject.versionStr +buildscript { + repositories { + maven { url = "https://maven.minecraftforge.net" } + maven { url = "https://repo.spongepowered.org/repository/maven-public/" } + mavenCentral() + } + dependencies { + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' + } +} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'org.spongepowered.mixin' -loom { - forge { - convertAccessWideners.set(true) - extraAccessWideners.add("lod.accesswidener") - mixinConfigs("DistantHorizons.mixins.json") +mixin { + add sourceSets.main, "DistantHorizons.refmap.json" + + config "DistantHorizons.mixins.json" +} + +minecraft { + mappings channel: 'official', version: minecraft_version +// mappings loom.layered() { +// // Mojmap mappings +// officialMojangMappings() +// // Parchment mappings (it adds parameter mappings & javadoc) +// parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip") +// } + + runs { + client { + workingDirectory project.file('run') + ideaModule "${rootProject.name}.${project.name}.main" + taskName 'Client' + args "-mixins.config=DistantHorizons.mixins.json" + } + + server { + workingDirectory project.file('run') + ideaModule "${rootProject.name}.${project.name}.main" + taskName 'Server' + args "-mixins.config=DistantHorizons.mixins.json" + } + + data { + workingDirectory project.file("run") + ideaModule "${rootProject.name}.${project.name}.main" + args '--mod', "lod", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + taskName 'Data' + args "-mixins.config=DistantHorizons.mixins.json" + } } } +//loom { +// forge { +// convertAccessWideners.set(true) +// extraAccessWideners.add("lod.accesswidener") +// mixinConfigs("DistantHorizons.mixins.json") +// } +//} -architectury { - platformSetupLoomIde() - forge() -} -loom { - accessWidenerPath = project(":common").loom.accessWidenerPath +//loom { +// accessWidenerPath = project(":common").loom.accessWidenerPath +// +// forge { +// convertAccessWideners = true +// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name +// } +//} - forge { - convertAccessWideners = true - extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - } -} - -configurations { - common - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentForge.extendsFrom common -} def addMod(path, enabled) { if (enabled == "2") - dependencies { modImplementation(path) } + dependencies { implementation(path) } else if (enabled == "1") dependencies { modCompileOnly(path) } } dependencies { // Forge loader - forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" + minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" // Architectury API if (minecraft_version == "1.16.5") { - modImplementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") + implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") } else { - modImplementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") + implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") } // Starlight @@ -61,6 +101,7 @@ dependencies { processResources { dependsOn(copyCoreResources) + dependsOn(copyAccessWidener) } shadowJar { @@ -85,11 +126,11 @@ shadowJar { mergeServiceFiles() } -remapJar { - input.set shadowJar.archiveFile - dependsOn shadowJar - classifier null -} +//remapJar { +// input.set shadowJar.archiveFile +// dependsOn shadowJar +// classifier null +//} jar { classifier "dev" diff --git a/gradle.properties b/gradle.properties index 52fd61191..a3821cc4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,31 +1,27 @@ org.gradle.jvmargs=-Xmx4096M # Mod Info -archives_base_name=DistantHorizons +mod_name=DistantHorizons mod_version=1.7.0-a-dev maven_group=com.seibel.lod -mod_name=Distant Horizons +mod_readable_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. mod_authors=["James Seibel", "Leonardo Amato", "Cola", "coolGi", "Ran", "Leetom"] mod_homepage=https://www.curseforge.com/minecraft/mc-mods/distant-horizons mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/ mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues - -# Architectury Version & Info -architectury_version=5.7.28 -enabled_platforms=fabric,forge +mod_discord=https://discord.gg/xAB8G4cENx # Global Plugin Versions +manifold_version=2022.1.19 toml_version=3.6.4 nightconfig_version=3.6.6 flatlaf_version=2.3 svgSalamander_version=1.1.3 -manifold_version=2022.1.19 -mcVersions=1.16.5,1.17.1,1.18.1,1.18.2,1.19,1.19.1,1.19.2 -# Internal Properties (These are set at runtime) +# Internal Properties (These are set at runtime for Forgix to merge jar's) versionStr= -##### This defines what MC version Intellij will use for the preprocessor -##### and what version is used automatically by build and run commands +# This defines what MC version Intellij will use for the preprocessor +# and what version is used automatically by build and run commands mcVer=1.18.2 diff --git a/settings.gradle b/settings.gradle index 9dd81f28b..f577f9eaf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,35 +1,37 @@ pluginManagement { repositories { - maven { url "https://maven.fabricmc.net/" } - maven { url "https://maven.architectury.dev/" } - maven { url "https://maven.minecraftforge.net/" } - maven { url "https://repo.spongepowered.org/repository/maven-public/"} + maven { + name "Fabric" + url "https://maven.fabricmc.net/" + } + maven { + name "Forge" + url "https://maven.minecraftforge.net/" + } + maven { // We may not use Quilt atm, but better to have it here for when it eventually gets added + name "Quilt" + url "https://maven.quiltmc.org/repository/release" + } + maven { // Used for Vanilla Minecraft's libraries + name "Sponge" + url "https://repo.spongepowered.org/repository/maven-public/" + } + mavenCentral() gradlePluginPortal() } } -// Minecraft dependent sub-projects -include("common") -include("fabric") - -// The logic for buildForge can be made more succinct, but the readability goes way down. -def buildForge = true -if (gradle.startParameter.taskRequests.size() > 0) { - if (gradle.startParameter.taskRequests[0].args.size() > 0) { - if (gradle.startParameter.taskRequests[0].args[0].startsWith("fabric:")) { - buildForge = false - } - } -} - -if (buildForge) { - include("forge") -} - // Minecraft independent sub-projects include("core") project(":core").projectDir = file('coreSubProjects/core') include("api") project(":api").projectDir = file('coreSubProjects/api') +// Minecraft dependent sub-projects +include("common") +include("fabric") +//include("quilt") // Just put this here for once we need it +include("forge") + + rootProject.name = "DistantHorizons" diff --git a/1.16.5.properties b/versionProperties/1.16.5.properties similarity index 95% rename from 1.16.5.properties rename to versionProperties/1.16.5.properties index 6137e9f37..fe24c8bd5 100644 --- a/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -1,9 +1,10 @@ # 1.16.5 version - java_version=8 minecraft_version=1.16.5 parchment_version=2022.03.06 compatible_minecraft_versions=["1.16.4", "1.16.5"] +accessWidenerVersion=1_16 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.13.2 diff --git a/1.17.1.properties b/versionProperties/1.17.1.properties similarity index 95% rename from 1.17.1.properties rename to versionProperties/1.17.1.properties index f914d74ff..ee3b7002f 100644 --- a/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -1,9 +1,10 @@ # 1.17.1 version - java_version=16 minecraft_version=1.17.1 parchment_version=2021.12.12 compatible_minecraft_versions=["1.17", "1.17.1"] +accessWidenerVersion=1_17 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.13.2 diff --git a/1.18.1.properties b/versionProperties/1.18.1.properties similarity index 95% rename from 1.18.1.properties rename to versionProperties/1.18.1.properties index 911e6bd00..4853b7337 100644 --- a/1.18.1.properties +++ b/versionProperties/1.18.1.properties @@ -1,9 +1,10 @@ # 1.18.1 version - java_version = 17 minecraft_version=1.18.1 parchment_version=2022.03.06 compatible_minecraft_versions=["1.18", "1.18.1"] +accessWidenerVersion=1_18 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.13.3 diff --git a/1.18.2.properties b/versionProperties/1.18.2.properties similarity index 95% rename from 1.18.2.properties rename to versionProperties/1.18.2.properties index 501c080a6..3f04b457d 100644 --- a/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -1,9 +1,10 @@ # 1.18.2 version based stuff - java_version = 17 minecraft_version=1.18.2 parchment_version=2022.03.13 compatible_minecraft_versions=["1.18.2"] +accessWidenerVersion=1_18 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.13.3 @@ -17,8 +18,8 @@ architectury_version=4.4.59 sodium_version=mc1.18.2-0.4.1 iris_version=1.18.x-v1.2.5 bclib_version=1.4.5 - canvas_version=mc118:1.0.2397 immersive_portals_version = v1.4.9-1.18 + canvas_version=mc118:1.0.2397 # Fabric mod run # 0 = Don't enable and don't run diff --git a/1.19.2.properties b/versionProperties/1.19.2.properties similarity index 94% rename from 1.19.2.properties rename to versionProperties/1.19.2.properties index 61681a13d..bc6dbc99a 100644 --- a/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -1,7 +1,10 @@ +# 1.19.2 version java_version = 17 minecraft_version=1.19.2 parchment_version=2022.08.10 compatible_minecraft_versions=["1.19.2"] +accessWidenerVersion=1_19 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.14.9 diff --git a/1.19.properties b/versionProperties/1.19.properties similarity index 94% rename from 1.19.properties rename to versionProperties/1.19.properties index 4d2287315..9a3538802 100644 --- a/1.19.properties +++ b/versionProperties/1.19.properties @@ -1,9 +1,10 @@ -# 1.18.2 version based stuff - +# 1.19 version java_version = 17 minecraft_version=1.19 parchment_version=2022.08.10 compatible_minecraft_versions=["1.19"] +accessWidenerVersion=1_19 +builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.14.7 @@ -16,8 +17,8 @@ architectury_version=5.6.24 lithium_version= sodium_version=3820973 iris_version=1.19.x-v1.2.5 - immersive_portals_version = bclib_version= + immersive_portals_version = canvas_version=mc118:1.0.2397 # Fabric mod run From d538b5c12bdbc4fdfb47f19ec894899a795225e8 Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 17 Nov 2022 19:10:01 +1030 Subject: [PATCH 02/12] Best that I can do with the build system for now (forgegradle hates me for some reason) --- build.gradle | 53 +++++++++++++-------- fabric/build.gradle | 20 ++++---- forge/build.gradle | 49 ++++++++++++------- forge/src/main/resources/META-INF/mods.toml | 9 +++- 4 files changed, 85 insertions(+), 46 deletions(-) diff --git a/build.gradle b/build.gradle index ddcc09a26..ced4c15ba 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { id "io.github.pacifistmc.forgix" version "1.2.6" // Manifold preprocessor - id 'systems.manifold.manifold-gradle-plugin' version '0.0.2-alpha' + id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha" // Provides mc libraries to core // id "org.spongepowered.gradle.vanilla" version '0.2.1-SNAPSHOT' apply false @@ -119,12 +119,22 @@ forgix { subprojects { p -> // Apply plugins apply plugin: "java" + apply plugin: "systems.manifold.manifold-gradle-plugin" apply plugin: "com.github.johnrengelman.shadow" // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries if (p == project(":core")) { apply plugin: "application" } + // Set the manifold version (may not be required tough) + manifold { + manifoldVersion = rootProject.manifold_version + } + + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" + // Usefull later on so we dont have duplicated code + def isMinecraftSubProject = p != project(":core") && p != project(":api") + // set up custom configurations (configurations are a way to handle dependencies) configurations { @@ -136,7 +146,7 @@ subprojects { p -> customModule implementation.extendsFrom(customModule) - if (p == project(":fabric") /* || p == project(":quilt") */ || p == project(":forge")) { + if (p != project(":api") && p != project(":core")) { // Shadow common common shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. @@ -147,7 +157,7 @@ subprojects { p -> } - // Set the standalone jar entrypoint + // Let the application plugin know where the main class is // (This will point to a non-existent class in all sub-projects except "Core") if (p == project(":core")) { application { @@ -191,7 +201,7 @@ subprojects { p -> //==========================// // Add core - if (p != project(":api") && p != project(":core")) { + if (isMinecraftSubProject) { implementation(project(":core")) { // Remove Junit test libraries exclude group: "org.junit.jupiter", module: "junit-jupiter" @@ -221,22 +231,24 @@ subprojects { p -> } // this can be un-commented if we ever wanted to make DH modular (AKA use a module-info.java file) again -// // Tells gradle where to look for other modules -// // Why isn't the classpath added to the modules path by default? -// if (p == project(":core")) { -// compileJava { -// inputs.property('moduleName', 'dhApi') -// doFirst { -// options.compilerArgs = [ -// '--module-path', classpath.asPath -// ] -// classpath = files() -// } -// } -// } + /* + // Tells gradle where to look for other modules + // Why isn't the classpath added to the modules path by default? + if (p == project(":core")) { + compileJava { + inputs.property('moduleName', 'dhApi') + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath + ] + classpath = files() + } + } + } + */ // Run mergeJars when running build - if (p != project(":api") && p != project(":core")) { + if (isMinecraftSubProject) { build.finalizedBy(mergeJars) assemble.finalizedBy(mergeJars) } @@ -385,13 +397,14 @@ allprojects { p -> } tasks.withType(JavaCompile) { - if (p != project(":core")) { + if (isMinecraftSubProject) { options.release = rootProject.java_version as Integer options.compilerArgs += ['-Xplugin:Manifold'] } else { -// options.release = 8; // Core should use Java 8 no matter what +// options.release = 8; // Core & Api should use Java 8 no matter what // No it shouldn't cause it fails to find minecraft if it uses Java 8 options.release = rootProject.java_version as Integer + // TODO: Once the new build system is done, check if there is a way to make core/api only use java 8 again } options.encoding = "UTF-8" } diff --git a/fabric/build.gradle b/fabric/build.gradle index bed5b641d..634449d32 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,9 +1,10 @@ plugins { - id "fabric-loom" version "0.12-SNAPSHOT" + id "fabric-loom" version "1.0-SNAPSHOT" } loom { - accessWidenerPath = project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener") + // FIXME: AccessWidener +// accessWidenerPath = project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener") runs { client { client() @@ -49,11 +50,11 @@ dependencies { implementation project(":common") // Architectury API - if (minecraft_version == "1.16.5") { - addModJar("me.shedaniel:architectury-fabric:${rootProject.architectury_version}") - } else { - addModJar("dev.architectury:architectury-fabric:${rootProject.architectury_version}") - } +// if (minecraft_version == "1.16.5") { +// addModJar("me.shedaniel:architectury-fabric:${rootProject.architectury_version}") +// } else { +// addModJar("dev.architectury:architectury-fabric:${rootProject.architectury_version}") +// } // Fabric API addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) @@ -133,7 +134,8 @@ shadowJar { } remapJar { - injectAccessWidener = true + // FIXME: AccessWidener +// injectAccessWidener = true input.set shadowJar.archiveFile dependsOn shadowJar classifier null @@ -174,7 +176,7 @@ components.java { publishing { publications { mavenFabric(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name + artifactId = rootProject.mod_name + "-" + project.name from components.java } } diff --git a/forge/build.gradle b/forge/build.gradle index 0fcc0db8c..fb88005dc 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,16 +1,19 @@ buildscript { repositories { maven { url = "https://maven.minecraftforge.net" } + maven { url = 'https://maven.parchmentmc.org' } maven { url = "https://repo.spongepowered.org/repository/maven-public/" } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + classpath 'org.parchmentmc:librarian:1.+' classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.spongepowered.mixin' +apply plugin: "net.minecraftforge.gradle" +apply plugin: "org.parchmentmc.librarian.forgegradle" +apply plugin: "org.spongepowered.mixin" mixin { add sourceSets.main, "DistantHorizons.refmap.json" @@ -19,13 +22,8 @@ mixin { } minecraft { - mappings channel: 'official', version: minecraft_version -// mappings loom.layered() { -// // Mojmap mappings -// officialMojangMappings() -// // Parchment mappings (it adds parameter mappings & javadoc) -// parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip") -// } +// mappings channel: 'official', version: minecraft_version // Vanilla mappings + mappings channel: "parchment", version: "${rootProject.parchment_version}-${rootProject.minecraft_version}" // Parchment mappings runs { client { @@ -47,10 +45,25 @@ minecraft { ideaModule "${rootProject.name}.${project.name}.main" args '--mod', "lod", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') taskName 'Data' - args "-mixins.config=DistantHorizons.mixins.json" + args "-mixins.config=DistantHorizons.mixins.json" // To add more mixins, you can just add a comma for another arg + // These may be needed altough im not sure +// mods { +// modDataRun { +// source sourceSets.main +// source project(":common").sourceSets.main +// } +// } } } } +// TODO: Check if the next 7 lines are necessary +sourceSets.main.resources.srcDir "src/generated/resources" +minecraft.runs.all { + lazyToken('minecraft_classpath') { + configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) + configurations.runtimeLibrary.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) + } +} //loom { // forge { @@ -83,11 +96,11 @@ dependencies { minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" // Architectury API - if (minecraft_version == "1.16.5") { - implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") - } else { - implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") - } +// if (minecraft_version == "1.16.5") { +// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}") +// } else { +// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}") +// } // Starlight addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge) @@ -95,6 +108,10 @@ dependencies { addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) + if (System.getProperty('idea.sync.active') != 'true') { + annotationProcessor 'org.spongepowered:mixin:0.8.4:processor' + } + common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } } @@ -151,7 +168,7 @@ components.java { publishing { publications { mavenForge(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name + artifactId = rootProject.mod_name + "-" + project.name from components.java } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 1f8382dd5..1a28469a2 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,6 +1,6 @@ modLoader="javafml" #//mandatory -loaderVersion="[36,42)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="*" # // mandatory. Allow all forge versions as we are definding what Minecraft versions we requre later on license="LGPL" issueTrackerURL="${issues}" @@ -24,3 +24,10 @@ issueTrackerURL="${issues}" #// Allow any version to be present (or not) on the server acceptableRemoteVersions="*" +# TODO: Add this for versioning in the build script +#[[dependencies.lod]] +# modId="minecraft" +# mandatory=true +# versionRange="[1.18.2,)" +# ordering="NONE" +# side="BOTH" \ No newline at end of file From ec8e54d31b09bae606de3bbfab1ad00c8b8755ec Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 17 Nov 2022 19:15:08 +1030 Subject: [PATCH 03/12] Forgot to add the "isMinecraftSubProject" variable to subprojects --- build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ced4c15ba..2e033b6ec 100644 --- a/build.gradle +++ b/build.gradle @@ -132,7 +132,7 @@ subprojects { p -> } // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" - // Usefull 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") @@ -262,6 +262,11 @@ allprojects { p -> version = rootProject.mod_version group = rootProject.maven_group + + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" + // Useful later on so we dont have duplicated code + def isMinecraftSubProject = p != project(":core") && p != project(":api") + repositories { mavenCentral() From 52005d0b19d13002a756277eca8dfa3e158949f9 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 24 Jan 2023 23:46:15 +1030 Subject: [PATCH 04/12] Added a proper fix for when forge is attempting to be run on a different version than intended --- build.gradle | 5 +++++ forge/build.gradle | 2 +- forge/src/main/resources/META-INF/mods.toml | 14 +++++++------- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 2e033b6ec..aff4c4277 100644 --- a/build.gradle +++ b/build.gradle @@ -351,6 +351,10 @@ allprojects { p -> } */ + // Fix forge version numbering system as it is weird + def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)") +// System.out.println(compatible_forgemc_versions) + // Put stuff from gradle.properties into the mod info processResources { def resourceTargets = ["fabric.mod.json", "quilt.mod.json", "META-INF/mods.toml"] // Location of where to inject the properties @@ -366,6 +370,7 @@ allprojects { p -> discord : mod_discord, minecraft_version : minecraft_version, compatible_minecraft_versions: compatible_minecraft_versions, + compatible_forgemc_versions : compatible_forgemc_versions, java_version : java_version ] // 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 diff --git a/forge/build.gradle b/forge/build.gradle index fb88005dc..2ca65285b 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,7 +1,7 @@ buildscript { repositories { maven { url = "https://maven.minecraftforge.net" } - maven { url = 'https://maven.parchmentmc.org' } + maven { url = "https://maven.parchmentmc.org" } maven { url = "https://repo.spongepowered.org/repository/maven-public/" } mavenCentral() } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 1a28469a2..94268a477 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -24,10 +24,10 @@ issueTrackerURL="${issues}" #// Allow any version to be present (or not) on the server acceptableRemoteVersions="*" -# TODO: Add this for versioning in the build script -#[[dependencies.lod]] -# modId="minecraft" -# mandatory=true -# versionRange="[1.18.2,)" -# ordering="NONE" -# side="BOTH" \ No newline at end of file + +[[dependencies.lod]] + modId="minecraft" + mandatory=true + versionRange="${compatible_forgemc_versions}" # Where we set what version of mc it is avalible for + ordering="NONE" + side="BOTH" \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a3821cc4f..ce910082f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues mod_discord=https://discord.gg/xAB8G4cENx # Global Plugin Versions -manifold_version=2022.1.19 +manifold_version=2022.1.5 toml_version=3.6.4 nightconfig_version=3.6.6 flatlaf_version=2.3 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb8790..070cb702f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 76f3a3cfcb4d6b934ecc72afdd5d5e6d0d38e1b6 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 29 Jan 2023 14:16:12 +1030 Subject: [PATCH 05/12] Disabled stuff that requires Architectury API (so the networking) --- .../lod/common/networking/NetworkReceiver.java | 4 ++++ .../seibel/lod/common/networking/Networking.java | 14 +++++++------- .../java/com/seibel/lod/FabricServerProxy.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/networking/NetworkReceiver.java b/common/src/main/java/com/seibel/lod/common/networking/NetworkReceiver.java index 49e6998dd..ca8692686 100644 --- a/common/src/main/java/com/seibel/lod/common/networking/NetworkReceiver.java +++ b/common/src/main/java/com/seibel/lod/common/networking/NetworkReceiver.java @@ -19,6 +19,7 @@ package com.seibel.lod.common.networking; +/* #if MC_1_16_5 import me.shedaniel.architectury.networking.NetworkManager; #else @@ -26,6 +27,7 @@ import dev.architectury.networking.NetworkManager; #endif import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; +*/ /** * @author Ran @@ -33,6 +35,7 @@ import net.minecraft.network.FriendlyByteBuf; // Comment: What does the 'server' side mean? Dedicated server? Or does it include the internal server? // (I removed the hookup that calls the register method, since I'm not sure what it is doing yet) public class NetworkReceiver { + /* public void register_Client() { NetworkManager.registerReceiver(NetworkManager.serverToClient(), Networking.RESOURCE_LOCATION, new ClientReceiver()); } @@ -54,4 +57,5 @@ public class NetworkReceiver { com.seibel.lod.common.networking.NetworkHandler.receivePacketClient(Minecraft.getInstance(), buf, context.getPlayer()); } } + */ } diff --git a/common/src/main/java/com/seibel/lod/common/networking/Networking.java b/common/src/main/java/com/seibel/lod/common/networking/Networking.java index b046bf84d..51c87b1a4 100644 --- a/common/src/main/java/com/seibel/lod/common/networking/Networking.java +++ b/common/src/main/java/com/seibel/lod/common/networking/Networking.java @@ -20,11 +20,11 @@ package com.seibel.lod.common.networking; import com.seibel.lod.core.ModInfo; -#if MC_1_16_5 -import me.shedaniel.architectury.networking.NetworkManager; -#else -import dev.architectury.networking.NetworkManager; -#endif +//#if MC_1_16_5 +//import me.shedaniel.architectury.networking.NetworkManager; +//#else +//import dev.architectury.networking.NetworkManager; +//#endif import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; @@ -57,7 +57,7 @@ public class Networking { * @param buf the payload of the packet. */ public static void send(ServerPlayer player, FriendlyByteBuf buf) { - NetworkManager.sendToPlayer(player, RESOURCE_LOCATION, buf); +// NetworkManager.sendToPlayer(player, RESOURCE_LOCATION, buf); } /** @@ -67,7 +67,7 @@ public class Networking { * @throws IllegalStateException if the client is not connected to a server */ public static void send(FriendlyByteBuf buf) throws IllegalStateException { - NetworkManager.sendToServer(RESOURCE_LOCATION, buf); +// NetworkManager.sendToServer(RESOURCE_LOCATION, buf); } } diff --git a/fabric/src/main/java/com/seibel/lod/FabricServerProxy.java b/fabric/src/main/java/com/seibel/lod/FabricServerProxy.java index 3012cb5e9..39309071d 100644 --- a/fabric/src/main/java/com/seibel/lod/FabricServerProxy.java +++ b/fabric/src/main/java/com/seibel/lod/FabricServerProxy.java @@ -104,7 +104,7 @@ public class FabricServerProxy { } // This just exists here for testing purposes, it'll be removed in the future - public void tester(MinecraftServer server) { + public void tester(MinecraftServer server) { // I disabled the Networking functions for now so this will not work atm - coolGi for (ServerPlayer player : server.getPlayerList().getPlayers()) { FriendlyByteBuf payload = Networking.createNew(); payload.writeInt(1); From 27a01d4da30840079a85d615368bf91b16e55477 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 29 Jan 2023 14:49:29 +1030 Subject: [PATCH 06/12] Added most of the core dependencies, fixed fabric runClient and disabled Forge for now --- build.gradle | 39 ++++++++++++++++++++++------- fabric/build.gradle | 4 +-- gradle.properties | 4 +++ settings.gradle | 2 +- versionProperties/1.18.2.properties | 2 +- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index aff4c4277..95e563a38 100644 --- a/build.gradle +++ b/build.gradle @@ -174,6 +174,13 @@ subprojects { p -> // Manifold annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}") + // Log4j + implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") + implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") + + // JOML + implementation("org.joml:joml:${rootProject.joml_version}") + // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") @@ -268,13 +275,17 @@ allprojects { p -> def isMinecraftSubProject = p != project(":core") && p != project(":api") repositories { + // The central repo mavenCentral() + // Used for Google's Collect library // TODO: Attempt to remove this library + maven { url "https://repo.enonic.com/public/" } + // For parchment mappings maven { url "https://maven.parchmentmc.org" } // For Architectury API -// maven { url "https://maven.architectury.dev" } + maven { url "https://maven.architectury.dev" } // For Git repositories maven { url "https://jitpack.io" } @@ -323,14 +334,16 @@ allprojects { p -> } } - - // Only uncomment this when testing stuff with lwjgl in the core jar - /* + // Adds some dependencies that are in vanilla but not in core if (p == project(":core")) { - dependencies { - project.ext.lwjglNatives = "natives-linux" + OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem; - implementation platform("org.lwjgl:lwjgl-bom:3.3.0") + // Set the OS lwjgl is using to the current os + project.ext.lwjglNatives = "natives-" + os.toFamilyName() + + dependencies { + // Imports most of lwjgl's libraries (well, only the ones that we need) + implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") implementation "org.lwjgl:lwjgl" implementation "org.lwjgl:lwjgl-assimp" @@ -346,10 +359,18 @@ allprojects { p -> runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" - implementation "org.joml:joml:1.10.2" + implementation "org.joml:joml:${rootProject.joml_version}" + + + // Some other dependencies + // TODO: Attempt to remove some of these dependencies from the core + implementation("org.jetbrains:annotations:16.0.2") + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.common:google-collect:0.5") + implementation("com.google.guava:guava:11.0.2") + implementation("it.unimi.dsi:fastutil:8.5.11") } } - */ // Fix forge version numbering system as it is weird def compatible_forgemc_versions = "${compatible_minecraft_versions}".replaceAll("\"", "").replaceAll("]", ",)") diff --git a/fabric/build.gradle b/fabric/build.gradle index 634449d32..511905610 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -109,8 +109,8 @@ dependencies { */ - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + common(project(path: ":common")) { transitive false } + shadowCommon(project(path: ":common")) { transitive false } } shadowJar { diff --git a/gradle.properties b/gradle.properties index ce910082f..4a51cd98a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,10 @@ nightconfig_version=3.6.6 flatlaf_version=2.3 svgSalamander_version=1.1.3 +log4j_version=2.19.0 +lwjgl_version=3.3.0 +joml_version=1.10.2 + # Internal Properties (These are set at runtime for Forgix to merge jar's) versionStr= diff --git a/settings.gradle b/settings.gradle index f577f9eaf..f8e386e7f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,7 +31,7 @@ project(":api").projectDir = file('coreSubProjects/api') include("common") include("fabric") //include("quilt") // Just put this here for once we need it -include("forge") +//include("forge") // FIXME: Fix forge, its just annoying rootProject.name = "DistantHorizons" diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index 3f04b457d..1451fb35c 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -9,9 +9,9 @@ builds_for=["fabric", "forge"] # Fabric loader fabric_loader_version=0.13.3 fabric_api_version=0.48.0+1.18.2 -architectury_version=4.4.59 # Fabric mod versions modmenu_version=3.1.0 + #architectury_version=4.4.59 starlight_version_fabric=3667443 phosphor_version_fabric=3573395 lithium_version=mc1.18.2-0.7.9 From 8de6ca33afc644156288852405abc4f95dc6412d Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 12 Feb 2023 20:11:53 +1030 Subject: [PATCH 07/12] Fabric now builds (and works outside the build environment) --- build.gradle | 32 ++++++++++++++--------- fabric/build.gradle | 8 ++++-- fabric/src/main/resources/fabric.mod.json | 2 ++ forge/build.gradle | 3 +++ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 95e563a38..ca4daf114 100644 --- a/build.gradle +++ b/build.gradle @@ -117,24 +117,27 @@ forgix { subprojects { p -> + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" + // Useful later on so we dont have duplicated code + def isMinecraftSubProject = p != project(":core") && p != project(":api") + + // Apply plugins apply plugin: "java" - apply plugin: "systems.manifold.manifold-gradle-plugin" + if (isMinecraftSubProject) + apply plugin: "systems.manifold.manifold-gradle-plugin" apply plugin: "com.github.johnrengelman.shadow" // apply plugin: "org.spongepowered.gradle.vanilla" // Provides minecraft libraries if (p == project(":core")) { apply plugin: "application" } + // Set the manifold version (may not be required tough) manifold { manifoldVersion = rootProject.manifold_version } - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" - // Useful later on so we dont have duplicated code - def isMinecraftSubProject = p != project(":core") && p != project(":api") - // set up custom configurations (configurations are a way to handle dependencies) configurations { @@ -146,7 +149,7 @@ subprojects { p -> customModule implementation.extendsFrom(customModule) - if (p != project(":api") && p != project(":core")) { + if (isMinecraftSubProject) { // Shadow common common shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. @@ -172,7 +175,8 @@ subprojects { p -> // Manifold - annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}") + if (isMinecraftSubProject) + annotationProcessor("systems.manifold:manifold-preprocessor:${rootProject.manifold_version}") // Log4j implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") @@ -207,6 +211,7 @@ subprojects { p -> // conditional dependencies // //==========================// + // Add core if (isMinecraftSubProject) { implementation(project(":core")) { @@ -262,18 +267,19 @@ subprojects { p -> } allprojects { p -> + // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" + // Useful later on so we dont have duplicated code + def isMinecraftSubProject = p != project(":core") && p != project(":api") + + apply plugin: "java" apply plugin: "maven-publish" archivesBaseName = rootProject.mod_name - version = rootProject.mod_version + version = project.name + "-" + rootProject.mod_version group = rootProject.maven_group - // Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge")" - // Useful later on so we dont have duplicated code - def isMinecraftSubProject = p != project(":core") && p != project(":api") - repositories { // The central repo mavenCentral() @@ -367,7 +373,7 @@ allprojects { p -> implementation("org.jetbrains:annotations:16.0.2") implementation("com.google.code.findbugs:jsr305:3.0.2") implementation("com.google.common:google-collect:0.5") - implementation("com.google.guava:guava:11.0.2") + implementation("com.google.guava:guava:31.1-jre") implementation("it.unimi.dsi:fastutil:8.5.11") } } diff --git a/fabric/build.gradle b/fabric/build.gradle index 511905610..5267d720e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,10 +1,10 @@ plugins { - id "fabric-loom" version "1.0-SNAPSHOT" + id "fabric-loom" version "1.1-SNAPSHOT" } loom { // FIXME: AccessWidener -// accessWidenerPath = project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener") + accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener") runs { client { client() @@ -111,10 +111,14 @@ dependencies { common(project(path: ":common")) { transitive false } shadowCommon(project(path: ":common")) { transitive false } +// shadowCommon(project(path: ":common"), configuration: "transformProductionFabric") { transitive false } // FIXME + shadowMe(project(path: ":core")) { transitive false } + shadowMe(project(path: ":api")) { transitive false } } shadowJar { configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] + relocate 'com.seibel.lod.common', 'loaderCommon.fabric.com.seibel.lod.common' // Compression relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index c0dd1dfa9..2113de2ae 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -16,6 +16,8 @@ "license": "LGPL-3", "icon": "icon.png", + "accessWidener": "lod.accesswidener", + "environment": "*", "entrypoints": { "client": [ diff --git a/forge/build.gradle b/forge/build.gradle index 2ca65285b..7f31e14e9 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -114,6 +114,8 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } + shadowMe(project(path: ":core")) { transitive false } + shadowMe(project(path: ":api")) { transitive false } } processResources { @@ -125,6 +127,7 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] + relocate 'com.seibel.lod.common', 'loaderCommon.forge.com.seibel.lod.common' // Compression relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' From 79ba86d8c23eb3a30a37bcf3fc2c701648c27995 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 12 Feb 2023 20:45:57 +1030 Subject: [PATCH 08/12] New Build system now works as good as the old build system (forge still broken) --- build.gradle | 1 + common/build.gradle | 2 +- coreSubProjects | 2 +- fabric/build.gradle | 2 ++ forge/build.gradle | 2 ++ versionProperties/1.18.2.properties | 4 ++-- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index ca4daf114..62dce0933 100644 --- a/build.gradle +++ b/build.gradle @@ -235,6 +235,7 @@ subprojects { p -> // Adds the standalone jar's entrypoint jar { + from "LICENSE.txt" manifest { attributes 'Implementation-Title': rootProject.mod_name, 'Implementation-Version': rootProject.mod_version, diff --git a/common/build.gradle b/common/build.gradle index 9d87530b4..d23ba8513 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,7 +3,7 @@ plugins { } minecraft { - accessWideners(project(":common").file("src/main/resources/${rootProject.accessWidenerVersion}.lod.accesswidener")) + accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener")) version(rootProject.minecraft_version) } diff --git a/coreSubProjects b/coreSubProjects index 5ec91475a..0c6e62040 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 5ec91475a4f0301d06bcb99fadf7f21e252d99ac +Subproject commit 0c6e62040653d0d3bc513059e168715b4dded797 diff --git a/fabric/build.gradle b/fabric/build.gradle index 5267d720e..10abedf5c 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -5,6 +5,8 @@ plugins { loom { // FIXME: AccessWidener accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.lod.accesswidener") + + // "runs" isn't required, but when we do need it then it can be useful runs { client { client() diff --git a/forge/build.gradle b/forge/build.gradle index 7f31e14e9..07bcf04f8 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -15,6 +15,8 @@ apply plugin: "net.minecraftforge.gradle" apply plugin: "org.parchmentmc.librarian.forgegradle" apply plugin: "org.spongepowered.mixin" +// TODO: Check accessWidener works fine + mixin { add sourceSets.main, "DistantHorizons.refmap.json" diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index 1451fb35c..6bf4a7397 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -7,8 +7,8 @@ accessWidenerVersion=1_18 builds_for=["fabric", "forge"] # Fabric loader -fabric_loader_version=0.13.3 -fabric_api_version=0.48.0+1.18.2 +fabric_loader_version=0.14.14 +fabric_api_version=0.67.1+1.18.2 # Fabric mod versions modmenu_version=3.1.0 #architectury_version=4.4.59 From e2dcbf48af9cce0fce727373aa9e28e635b0a162 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 12 Feb 2023 22:19:36 +1030 Subject: [PATCH 09/12] Made jar size around 1.5 MB smaller by removing an unused dependency --- build.gradle | 1 - fabric/build.gradle | 1 - forge/build.gradle | 36 ++++++++++++++--------------- settings.gradle | 2 +- versionProperties/1.18.2.properties | 2 +- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 62dce0933..156a379b2 100644 --- a/build.gradle +++ b/build.gradle @@ -192,7 +192,6 @@ subprojects { p -> // Compression shadowMe("org.tukaani:xz:1.9") - shadowMe("org.apache.commons:commons-compress:1.21") // NightConfig (includes Toml & Json) shadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") diff --git a/fabric/build.gradle b/fabric/build.gradle index 10abedf5c..fda3e0485 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -124,7 +124,6 @@ shadowJar { // Compression relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' - relocate 'org.apache.commons.compress', 'distanthorizons.libraries.apache.commons.compress' // NightConfig (includes Toml & Json) relocate 'com.electronwill.nightconfig', 'distanthorizons.libraries.electronwill.nightconfig' diff --git a/forge/build.gradle b/forge/build.gradle index 07bcf04f8..01691ae01 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -6,9 +6,8 @@ buildscript { mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - classpath 'org.parchmentmc:librarian:1.+' - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' + classpath group: "".minecraftforge.gradle"" name: ""orgeGradle"" version: "".1.+"" changing: true + classpath ""rg.parchmentmc:librarian:1.+""classpath ""rg.spongepowered:mixingradle:0.7-SNAPSHOT" } } apply plugin: "net.minecraftforge.gradle" @@ -24,21 +23,21 @@ mixin { } minecraft { -// mappings channel: 'official', version: minecraft_version // Vanilla mappings - mappings channel: "parchment", version: "${rootProject.parchment_version}-${rootProject.minecraft_version}" // Parchment mappings +// mappings channel: "official", version: minecraft_version // Vanilla mappings + mappings channel: "parchment", version: "${parchment_version}-${minecraft_version}" // Parchment mappings runs { client { - workingDirectory project.file('run') + workingDirectory project.file("run") ideaModule "${rootProject.name}.${project.name}.main" - taskName 'Client' + taskName "Client" args "-mixins.config=DistantHorizons.mixins.json" } server { - workingDirectory project.file('run') + workingDirectory project.file("run") ideaModule "${rootProject.name}.${project.name}.main" - taskName 'Server' + taskName "Server" args "-mixins.config=DistantHorizons.mixins.json" } @@ -110,12 +109,12 @@ dependencies { addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) - if (System.getProperty('idea.sync.active') != 'true') { - annotationProcessor 'org.spongepowered:mixin:0.8.4:processor' + if (System.getProperty("idea.sync.active") != "true") { + annotationProcessor "org.spongepowered:mixin:0.8.4:processor" } - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } + common(project(path: ":common")) { transitive false } + shadowCommon(project(path: ":common")) { transitive false } shadowMe(project(path: ":core")) { transitive false } shadowMe(project(path: ":api")) { transitive false } } @@ -129,20 +128,19 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule] - relocate 'com.seibel.lod.common', 'loaderCommon.forge.com.seibel.lod.common' + relocate "om.seibel.lod.common", "loaderCommon.forge.com.seibel.lod.common" // Compression - relocate 'org.tukaani', 'distanthorizons.libraries.tukaani' - relocate 'org.apache.commons.compress', 'distanthorizons.libraries.apache.commons.compress' + relocate "org.tukaani", "distanthorizons.libraries.tukaani" // NightConfig (includes Toml & Json) - relocate 'com.electronwill.nightconfig', 'distanthorizons.libraries.electronwill.nightconfig' + relocate "com.electronwill.nightconfig", "distanthorizons.libraries.electronwill.nightconfig" // Theming - relocate 'com.formdev.flatlaf', 'distanthorizons.libraries.formdev.flatlaf' + relocate "com.formdev.flatlaf", "distanthorizons.libraries.formdev.flatlaf" // svg - relocate 'com.kitfox.svg', 'distanthorizons.libraries.kitfox.svg' + relocate "com.kitfox.svg", "distanthorizons.libraries.kitfox.svg" classifier "dev-shadow" mergeServiceFiles() diff --git a/settings.gradle b/settings.gradle index f8e386e7f..273336f26 100644 --- a/settings.gradle +++ b/settings.gradle @@ -30,7 +30,7 @@ project(":api").projectDir = file('coreSubProjects/api') // Minecraft dependent sub-projects include("common") include("fabric") -//include("quilt") // Just put this here for once we need it +//include("quilt") // Just put this here for once we need it ;) //include("forge") // FIXME: Fix forge, its just annoying diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index 6bf4a7397..5a25cf599 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -1,7 +1,7 @@ # 1.18.2 version based stuff java_version = 17 minecraft_version=1.18.2 -parchment_version=2022.03.13 +parchment_version=2022.11.06 compatible_minecraft_versions=["1.18.2"] accessWidenerVersion=1_18 builds_for=["fabric", "forge"] From cf976cef8421a098881344b3413a384795c2b57f Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 12 Feb 2023 22:21:01 +1030 Subject: [PATCH 10/12] Fixed double quotes from last push --- forge/build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forge/build.gradle b/forge/build.gradle index 01691ae01..b44c609f6 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -6,8 +6,9 @@ buildscript { mavenCentral() } dependencies { - classpath group: "".minecraftforge.gradle"" name: ""orgeGradle"" version: "".1.+"" changing: true - classpath ""rg.parchmentmc:librarian:1.+""classpath ""rg.spongepowered:mixingradle:0.7-SNAPSHOT" + classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "5.1.+", changing: true + classpath "org.parchmentmc:librarian:1.+" + classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT" } } apply plugin: "net.minecraftforge.gradle" From 55bf0c04f4725265ee7927d2b82077d40fa991fa Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 13 Feb 2023 18:17:53 +1030 Subject: [PATCH 11/12] Added temporary accesstransformer --- forge/build.gradle | 2 ++ .../src/main/resources/accesstransformer.cfg | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 forge/src/main/resources/accesstransformer.cfg diff --git a/forge/build.gradle b/forge/build.gradle index b44c609f6..247b70796 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -27,6 +27,8 @@ minecraft { // mappings channel: "official", version: minecraft_version // Vanilla mappings mappings channel: "parchment", version: "${parchment_version}-${minecraft_version}" // Parchment mappings + accessTransformer = project(":forge").file("src/main/resources/accesstransformer.cfg") // FIXME: Find a libary to use fabric's accessWidener instead of forge's own accesstransformer format + runs { client { workingDirectory project.file("run") diff --git a/forge/src/main/resources/accesstransformer.cfg b/forge/src/main/resources/accesstransformer.cfg new file mode 100644 index 000000000..e9eb6a824 --- /dev/null +++ b/forge/src/main/resources/accesstransformer.cfg @@ -0,0 +1,28 @@ +public net.minecraft.world.level.lighting.LevelLightEngine f_75802_ +public net.minecraft.world.level.lighting.LevelLightEngine f_75803_ +public net.minecraft.client.renderer.LevelRenderer$RenderChunkInfo +public net.minecraft.client.renderer.LevelRenderer$RenderChunkInfo f_109839_ +public net.minecraft.world.level.biome.Biome f_47438_ +public net.minecraft.world.level.biome.Biome f_47442_ +public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture +public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture m_174764_(I)I +public net.minecraft.client.renderer.texture.TextureAtlasSprite$AnimatedTexture m_174759_(I)I +public net.minecraft.world.level.levelgen.Heightmap m_64245_(III)V +public net.minecraft.world.level.storage.DimensionDataStorage f_78146_ +public net.minecraft.client.renderer.LevelRenderer f_194307_ +public-f com.mojang.math.Matrix4f +public net.minecraft.client.renderer.texture.TextureAtlasSprite f_118342_ +public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174723_ +public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174725_ +public net.minecraft.client.renderer.texture.TextureAtlasSprite f_174724_ +public net.minecraft.client.renderer.LevelRenderer$RenderChunkStorage +public net.minecraft.client.renderer.GameRenderer m_109141_(Lnet/minecraft/client/Camera;FZ)D +public-f net.minecraft.util.ThreadingDetector f_199409_ +public net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_188662_(Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess; +public com.mojang.blaze3d.vertex.VertexBuffer f_166859_ +public com.mojang.blaze3d.vertex.VertexBuffer f_166863_ +public net.minecraft.server.level.ChunkMap f_140135_ +public net.minecraft.server.level.ChunkMap m_140427_(Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag; +public net.minecraft.client.renderer.LightTexture f_109870_ +public net.minecraft.client.renderer.LightTexture f_109871_ +public net.minecraft.world.level.lighting.LayerLightEngine m_75660_(JLnet/minecraft/world/level/chunk/DataLayer;Z)V From a719ec5a3e281161c778f400d9ff016b7f98d3ce Mon Sep 17 00:00:00 2001 From: coolGi Date: Mon, 13 Feb 2023 19:07:50 +1030 Subject: [PATCH 12/12] Added some more stuff to attempt to fix forge --- build.gradle | 3 ++ common/build.gradle | 3 ++ forge/build.gradle | 42 ++++++++++++------- .../{ => META-INF}/accesstransformer.cfg | 0 4 files changed, 34 insertions(+), 14 deletions(-) rename forge/src/main/resources/{ => META-INF}/accesstransformer.cfg (100%) diff --git a/build.gradle b/build.gradle index 156a379b2..2f95173ae 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,9 @@ def loadProperties() { for (int i = 0; i < mcVers.size(); i++) { mcVers[i] = mcVers[i].replaceAll(".properties", "") // As we are getting the file names, we should remove the ".properties" at the end to get the versions } + + mcVers.sort() // Sort so it always goes from oldest to newest + int mcIndex = -1 println "Avalible MC versions: ${mcVers}" if (project.hasProperty("mcVer")) { diff --git a/common/build.gradle b/common/build.gradle index d23ba8513..85a243371 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -11,6 +11,9 @@ dependencies { // 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 // modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + + // So mixins can be written in common + compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' } diff --git a/forge/build.gradle b/forge/build.gradle index 247b70796..0e41d49e7 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -27,7 +27,7 @@ minecraft { // mappings channel: "official", version: minecraft_version // Vanilla mappings mappings channel: "parchment", version: "${parchment_version}-${minecraft_version}" // Parchment mappings - accessTransformer = project(":forge").file("src/main/resources/accesstransformer.cfg") // FIXME: Find a libary to use fabric's accessWidener instead of forge's own accesstransformer format + accessTransformer = project(":forge").file("src/main/resources/META-INF/accesstransformer.cfg") // FIXME: Find a libary to use fabric's accessWidener instead of forge's own accesstransformer format runs { client { @@ -35,14 +35,25 @@ minecraft { ideaModule "${rootProject.name}.${project.name}.main" taskName "Client" args "-mixins.config=DistantHorizons.mixins.json" + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" + mods { + modClientRun { + source sourceSets.main + source project(":common").sourceSets.main + source project(":core").sourceSets.main + source project(":api").sourceSets.main + } + } } - server { - workingDirectory project.file("run") - ideaModule "${rootProject.name}.${project.name}.main" - taskName "Server" - args "-mixins.config=DistantHorizons.mixins.json" - } + // TODO: Do this once client works +// server { +// workingDirectory project.file("run") +// ideaModule "${rootProject.name}.${project.name}.main" +// taskName "Server" +// args "-mixins.config=DistantHorizons.mixins.json" +// } data { workingDirectory project.file("run") @@ -50,13 +61,16 @@ minecraft { args '--mod', "lod", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') taskName 'Data' args "-mixins.config=DistantHorizons.mixins.json" // To add more mixins, you can just add a comma for another arg - // These may be needed altough im not sure -// mods { -// modDataRun { -// source sourceSets.main -// source project(":common").sourceSets.main -// } -// } + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" + mods { + modClientRun { + source sourceSets.main + source project(":common").sourceSets.main + source project(":core").sourceSets.main + source project(":api").sourceSets.main + } + } } } } diff --git a/forge/src/main/resources/accesstransformer.cfg b/forge/src/main/resources/META-INF/accesstransformer.cfg similarity index 100% rename from forge/src/main/resources/accesstransformer.cfg rename to forge/src/main/resources/META-INF/accesstransformer.cfg