From 323eced2a4d1a0c158f551753013e198ea2af7a2 Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Fri, 31 Dec 2021 17:24:45 +1030 Subject: [PATCH] Fixed cloud problems --- .../java/com/seibel/lod/common/Config.java | 8 ++++++- .../lod/common/clouds/SkyCoverGenerators.java | 2 +- .../main/resources/assets/lod/lang/en_us.json | 7 +++++-- .../lod/fabric/mixins/MixinWorldRenderer.java | 5 +---- .../lod/forge/mixins/MixinWorldRenderer.java | 21 +++++++++---------- 5 files changed, 24 insertions(+), 19 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 22a7dd84a..0f2e67fef 100644 --- a/common/src/main/java/com/seibel/lod/common/Config.java +++ b/common/src/main/java/com/seibel/lod/common/Config.java @@ -20,12 +20,14 @@ package com.seibel.lod.common; import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.common.wrappers.world.DimensionTypeWrapper; import com.seibel.lod.core.config.*; import com.seibel.lod.core.enums.config.*; import com.seibel.lod.core.enums.rendering.*; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.*; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.*; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator; +import net.minecraft.client.renderer.DimensionSpecialEffects; /** * This handles any configuration the user has access to. @@ -142,13 +144,17 @@ public class Config extends ConfigGui @ConfigAnnotations.Entry public static boolean customClouds = false; + @ConfigAnnotations.Category("client.graphics.cloudQuality") + @ConfigAnnotations.Entry + public static boolean fabulousClouds = true; + @ConfigAnnotations.Category("client.graphics.cloudQuality") @ConfigAnnotations.Entry public static boolean extendClouds = true; @ConfigAnnotations.Category("client.graphics.cloudQuality") @ConfigAnnotations.Entry - public static int cloudHeight = 192; + public static double cloudHeight = DimensionSpecialEffects.OverworldEffects.CLOUD_LEVEL; } diff --git a/common/src/main/java/com/seibel/lod/common/clouds/SkyCoverGenerators.java b/common/src/main/java/com/seibel/lod/common/clouds/SkyCoverGenerators.java index c56b7b80d..712cade67 100644 --- a/common/src/main/java/com/seibel/lod/common/clouds/SkyCoverGenerators.java +++ b/common/src/main/java/com/seibel/lod/common/clouds/SkyCoverGenerators.java @@ -11,7 +11,7 @@ public class SkyCoverGenerators { public static final int COLOR = NativeImage.combine(255, 255, 255, 255); // Where the generator for clouds could be made - // TODO: Try to impliment this https://www.reddit.com/r/Minecraft/comments/e7xol/this_is_how_clouds_should_work_gif_simulation/ + // TODO: Try to implement this https://www.reddit.com/r/Minecraft/comments/e7xol/this_is_how_clouds_should_work_gif_simulation/ public static void clearSkyGenerator(SimplexNoise noiseSampler, NativeImage image, double cloudiness) { for (int x = 0; x < 256; x++) { diff --git a/common/src/main/resources/assets/lod/lang/en_us.json b/common/src/main/resources/assets/lod/lang/en_us.json index cd2083699..51724f6d2 100644 --- a/common/src/main/resources/assets/lod/lang/en_us.json +++ b/common/src/main/resources/assets/lod/lang/en_us.json @@ -2,6 +2,7 @@ "lod.title": "Distant Horizons", "DistantHorizons.config.title": "Distant Horizons config", "DistantHorizons.config.ShowButton": "Show menu button", + "DistantHorizons.config.ShowButton.@tooltip": "Show the custom button to the left of the fov button", "DistantHorizons.config.client": "Client", "DistantHorizons.config.client.graphics": "Graphics", "DistantHorizons.config.client.graphics.quality": "Quality options", @@ -25,8 +26,10 @@ "DistantHorizons.config.client.graphics.fogQuality.disableVanillaFog": "Disable vanilla fog", "DistantHorizons.config.client.graphics.fogQuality.disableVanillaFog.@tooltip": "If true disable Minecraft's fog. \nMay cause issues with other mods that edit fog. \nMay cause errors with other fog editing mods", "DistantHorizons.config.client.graphics.cloudQuality": "Cloud options", - "DistantHorizons.config.client.graphics.cloudQuality.customCloud": "Custom cloud", - "DistantHorizons.config.client.graphics.cloudQuality.customCloud.@tooltip": "Do you want to use a custom way or rendering the clouds. \nIf you turn this off then the other settings here wont do anything \nThis will also make the clouds more dynamic", + "DistantHorizons.config.client.graphics.cloudQuality.customClouds": "Custom cloud", + "DistantHorizons.config.client.graphics.cloudQuality.customClouds.@tooltip": "Do you want to use a custom way or rendering the clouds. \nIf you turn this off then the other settings here wont do anything \nThis will also make the clouds more dynamic", + "DistantHorizons.config.client.graphics.cloudQuality.fabulousClouds": "Fabulous clouds", + "DistantHorizons.config.client.graphics.cloudQuality.fabulousClouds.@tooltip": "Makes clouds look way better. \nTHIS IS CURRENTLY AN EXPERIMENTAL SETTING", "DistantHorizons.config.client.graphics.cloudQuality.extendClouds": "Extend the clouds", "DistantHorizons.config.client.graphics.cloudQuality.cloudHeight": "Cloud height", "DistantHorizons.config.client.graphics.advancedGraphics": "Advanced quality option", diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java index 5c5cfb04f..a7d3459fe 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java @@ -40,15 +40,12 @@ import net.minecraft.client.renderer.RenderType; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import net.minecraft.client.CloudStatus; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; @@ -99,7 +96,7 @@ public class MixinWorldRenderer if (minecraft.level.dimension() == ClientLevel.OVERWORLD) { CloudTexture cloudTexture = NoiseCloudHandler.cloudTextures.get(NoiseCloudHandler.cloudTextures.size() - 1); - renderCloudLayer(poseStack, model, tickDelta, cameraX, cameraY, cameraZ, Config.Client.Graphics.CloudQuality.cloudHeight, 0, 1, 1, cloudTexture.resourceLocation); + renderCloudLayer(poseStack, model, tickDelta, cameraX, cameraY, cameraZ, (float) (Config.Client.Graphics.CloudQuality.cloudHeight + 0.01 /* Make clouds a bit higher so it dosnt do janky stuff */), 0, 1, 1, cloudTexture.resourceLocation); } ci.cancel(); diff --git a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java index db59652df..705c1114d 100644 --- a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java +++ b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java @@ -40,15 +40,12 @@ import net.minecraft.client.renderer.RenderType; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import net.minecraft.client.CloudStatus; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; @@ -92,17 +89,19 @@ public class MixinWorldRenderer @Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true) public void renderClouds(PoseStack poseStack, Matrix4f model, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) { - TextureManager textureManager = Minecraft.getInstance().getTextureManager(); - registerClouds(textureManager); - NoiseCloudHandler.update(); + if (Config.Client.Graphics.CloudQuality.customClouds) { + TextureManager textureManager = Minecraft.getInstance().getTextureManager(); + registerClouds(textureManager); + NoiseCloudHandler.update(); - if (minecraft.level.dimension() == ClientLevel.OVERWORLD) { - CloudTexture cloudTexture = NoiseCloudHandler.cloudTextures.get(NoiseCloudHandler.cloudTextures.size() - 1); - renderCloudLayer(poseStack, model, tickDelta, cameraX, cameraY, cameraZ, Config.Client.Graphics.CloudQuality.cloudHeight, 0, 1, 1, cloudTexture.resourceLocation); + if (minecraft.level.dimension() == ClientLevel.OVERWORLD) { + CloudTexture cloudTexture = NoiseCloudHandler.cloudTextures.get(NoiseCloudHandler.cloudTextures.size() - 1); + renderCloudLayer(poseStack, model, tickDelta, cameraX, cameraY, cameraZ, (float) (Config.Client.Graphics.CloudQuality.cloudHeight + 0.01 /* Make clouds a bit higher so it dosnt do janky stuff */), 0, 1, 1, cloudTexture.resourceLocation); + } + + ci.cancel(); } - ci.cancel(); - // get the partial ticks since renderChunkLayer doesn't // have access to them previousPartialTicks = tickDelta;