From 3a0deb51116dd2827f6b555a286975631c599cc6 Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Fri, 28 Jan 2022 19:46:02 +1030 Subject: [PATCH] Down-ported everything from 1.18 to 1.17 (not including world gen) --- .../java/com/seibel/lod/common/Config.java | 4 +- .../config/LodConfigWrapperSingleton.java | 10 ++--- common/src/main/resources/lod.accesswidener | 1 + core | 2 +- fabric/build.gradle | 40 ++++++++++++++----- fabric/src/main/resources/fabric.mod.json | 12 ++---- forge/build.gradle | 29 +++++++++++++- forge/src/main/resources/META-INF/mods.toml | 8 ++-- gradle.properties | 4 ++ 9 files changed, 79 insertions(+), 31 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/Config.java b/common/src/main/java/com/seibel/lod/common/Config.java index cc085d08c..4286bf23e 100644 --- a/common/src/main/java/com/seibel/lod/common/Config.java +++ b/common/src/main/java/com/seibel/lod/common/Config.java @@ -161,9 +161,9 @@ public class Config extends ConfigGui public static boolean customClouds = ICloudQuality.CUSTOM_CLOUDS_DEFAULT; @ConfigAnnotations.FileComment - public static String _fabulousClouds = ICloudQuality.FABULOUS_CLOUDS_DESC; + public static String _coolClouds = ICloudQuality.COOL_CLOUDS_DESC; @ConfigAnnotations.Entry - public static boolean fabulousClouds = ICloudQuality.FABULOUS_CLOUDS_DEFAULT; + public static boolean coolClouds = ICloudQuality.COOL_CLOUDS_DEFAULT; @ConfigAnnotations.FileComment public static String _extendClouds = ICloudQuality.EXTEND_CLOUDS_DESC; diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java index 43a4d8169..17a4bf5ad 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java @@ -271,15 +271,15 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton @Override - public boolean getFabulousClouds() + public boolean getCoolClouds() { - return Config.Client.Graphics.CloudQuality.fabulousClouds; + return Config.Client.Graphics.CloudQuality.coolClouds; } @Override - public void setFabulousClouds(boolean newFabulousClouds) + public void setCoolClouds(boolean newCoolClouds) { - ConfigGui.editSingleOption.getEntry("client.graphics.cloudQuality.fabulousClouds").value = newFabulousClouds; - ConfigGui.editSingleOption.saveOption("client.graphics.cloudQuality.fabulousClouds"); + ConfigGui.editSingleOption.getEntry("client.graphics.cloudQuality.coolClouds").value = newCoolClouds; + ConfigGui.editSingleOption.saveOption("client.graphics.cloudQuality.coolClouds"); } diff --git a/common/src/main/resources/lod.accesswidener b/common/src/main/resources/lod.accesswidener index e23e10004..594426ce4 100644 --- a/common/src/main/resources/lod.accesswidener +++ b/common/src/main/resources/lod.accesswidener @@ -26,6 +26,7 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings; accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Ljava/util/function/Supplier; +accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V # lod generation from save file accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop; diff --git a/core b/core index 410fe684e..4bcb6c0ac 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 410fe684ec3981f687198036a75b985e12a3087b +Subproject commit 4bcb6c0acd5e31a247d7c706e3fcf99cedb236dc diff --git a/fabric/build.gradle b/fabric/build.gradle index d883bf3ba..f8be4c323 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -39,26 +39,26 @@ dependencies { } // Sodium - modImplementation "maven.modrinth:sodium:${project.sodium_version}" + modImplementation "maven.modrinth:sodium:${rootProject.sodium_version}" implementation "org.joml:joml:1.10.2" // Lithium -// modImplementation "maven.modrinth:lithium:${project.lithium_version}" +// modImplementation "maven.modrinth:lithium:${rootProject.lithium_version}" // Iris -// modImplementation "maven.modrinth:iris:${project.iris_version}" +// modImplementation "maven.modrinth:iris:${rootProject.iris_version}" // Immersive Portals /* - modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${project.immersive_portals_version}") { + modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${rootProject.immersive_portals_version}") { exclude(group: "net.fabricmc.fabric-api") transitive(false) } - modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") { + modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}") { exclude(group: "net.fabricmc.fabric-api") transitive(false) } - modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${project.immersive_portals_version}") { + modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version}") { exclude(group: "net.fabricmc.fabric-api") transitive(false) } @@ -106,12 +106,34 @@ runClient { finalizedBy(deleteResources) } +// Put stuff from gradle.properties into the mod info stuff +def resourceTargets = ["fabric.mod.json"] +def intoTargets = ["$buildDir/resources/main/"] +def replaceProperties = [ + version: mod_version, + mod_name: mod_name, + authors: mod_authors, + description: mod_description +] + processResources { dependsOn(copyAccessWidener) - inputs.property "version", project.version + inputs.properties replaceProperties + replaceProperties.put 'project', project + filesMatching(resourceTargets) { + expand replaceProperties + } - filesMatching("fabric.mod.json") { - expand "version": project.version + intoTargets.each { target -> + if (file(target).exists()) { + copy { + from(sourceSets.main.resources) { + include resourceTargets + expand replaceProperties + } + into target + } + } } } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index ed607cc31..cd1c74cda 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -3,15 +3,9 @@ "id": "lod", "version": "${version}", - "name": "Distant Horizons Fabric", - "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.", - "authors": [ - "James Seibel", - "Leonardo Amato", - "Cola", - "coolGi2007", - "Ran" - ], + "name": "${mod_name}", + "description": "${description}", + "authors": ["${authors}"], "contact": { "homepage": "https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail", diff --git a/forge/build.gradle b/forge/build.gradle index 022f945e5..c2408ada6 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -33,7 +33,7 @@ dependencies { shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } // Starlight -// modImplementation("curse.maven:starlight-forge-526854:${project.starlight_version_forge}") +// modImplementation("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}") // implementation("com.electronwill.night-config:toml:${rootProject.toml_version}") // forgeDependencies(shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {}) @@ -56,9 +56,36 @@ task copyCommonResources(type: Copy) { into file("build/resources/main") } +// Put stuff from gradle.properties into the mod info stuff +def resourceTargets = ["META-INF/mods.toml"] +def intoTargets = ["$buildDir/resources/main/"] +def replaceProperties = [ + version: mod_version, + mod_name: mod_name, + authors: mod_authors, + description: mod_description +] + processResources { dependsOn(copyCoreResources) dependsOn(copyCommonResources) + 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 + } + } + } } shadowJar { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 281f3bd3d..c5b637c28 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -7,16 +7,16 @@ issueTrackerURL="https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues" [[mods]] #//mandatory modId="lod" #//mandatory - version= "${file.jarVersion}" #//mandatory, gets the version number from jar populated by the build.gradle script - displayName="Distant Horizons" #//mandatory + version= "${version}" #//mandatory, gets the version number from jar populated by the build.gradle script + displayName="${mod_name}" #//mandatory #//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ displayURL="https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail" logoFile="logo.png" catalogueImageIcon="icon.png" credits="Massive thanks to: Leonardo, Cola, Ran, and CoolGi. For their hard work to bring Distant Horizons to where it is today. - James" - authors="James Seibel, Leonardo Amato, and Cola" + authors="${authors}" #//mandatory. The description text for the 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. ''' + description= ''' ${description} ''' #// if not set defaults to "false" clientSideOnly="true" #// if not set defaults to "BOTH" diff --git a/gradle.properties b/gradle.properties index 33ad23a55..0f4ae5bfc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,10 @@ mod_version=1.6.0a-pre maven_group=com.seibel.lod toml_version=3.6.0 +# Mod info +mod_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, coolGi2007, Ran # Fabric loader fabric_loader_version=0.12.6