-
Notifications
You must be signed in to change notification settings - Fork 18
[1.20.4] Feat: Skybox and fog colors #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7bc563
Added feature WorldColors that changes sky color and fog color
Camii2407 d2bf92d
Merge branch 'master' into feature/skycolor
emyfops 7e29ce7
Added cloud color changer in WorldColors and Vec3d in ColorUtils
Camii2407 e3328ae
Added avens improvements to WorldColors
Camii2407 d8b509f
Match background to fog color
Avanatiker eff64d4
Merge branch 'master' into feature/skycolor
Avanatiker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
common/src/main/java/com/lambda/mixin/render/BackgroundRendererMixin.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.lambda.mixin.render; | ||
|
|
||
| import com.lambda.module.modules.render.WorldColors; | ||
| import net.minecraft.client.render.BackgroundRenderer; | ||
| import net.minecraft.util.math.Vec3d; | ||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
|
||
| @Mixin(BackgroundRenderer.class) | ||
| public class BackgroundRendererMixin { | ||
| @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getX()D")) | ||
| private static double redirectRed(Vec3d baseColor) { | ||
| return WorldColors.backgroundColor(baseColor).getX(); | ||
| } | ||
|
|
||
| @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getY()D")) | ||
| private static double redirectGreen(Vec3d baseColor) { | ||
| return WorldColors.backgroundColor(baseColor).getY(); | ||
| } | ||
|
|
||
| @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getZ()D")) | ||
| private static double redirectBlue(Vec3d baseColor) { | ||
| return WorldColors.backgroundColor(baseColor).getZ(); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
common/src/main/java/com/lambda/mixin/render/RenderSystemMixin.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.lambda.mixin.render; | ||
|
|
||
| import com.lambda.module.modules.render.WorldColors; | ||
| import com.mojang.blaze3d.systems.RenderSystem; | ||
| import org.spongepowered.asm.mixin.Final; | ||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.Shadow; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Inject; | ||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
|
||
| @Mixin(RenderSystem.class) | ||
| public class RenderSystemMixin { | ||
| @Shadow @Final private static float[] shaderFogColor; | ||
|
|
||
| @Inject(method = "_setShaderFogColor", at = @At(value ="HEAD"), cancellable = true) | ||
| private static void onSetShaderFogColor(float red, float green, float blue, float alpha, CallbackInfo ci){ | ||
| if (WorldColors.INSTANCE.isEnabled() && WorldColors.getCustomFog()){ | ||
| ci.cancel(); | ||
| shaderFogColor[0] = WorldColors.getFogColor().getRed() / 255f; | ||
| shaderFogColor[1] = WorldColors.getFogColor().getGreen() / 255f; | ||
| shaderFogColor[2] = WorldColors.getFogColor().getBlue() / 255f; | ||
| shaderFogColor[3] = WorldColors.getFogColor().getAlpha() / 255f; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
common/src/main/kotlin/com/lambda/module/modules/render/WorldColors.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.lambda.module.modules.render | ||
|
|
||
| import com.lambda.module.Module | ||
| import com.lambda.module.tag.ModuleTag | ||
| import com.lambda.util.math.ColorUtils.vec3d | ||
| import net.minecraft.util.math.Vec3d | ||
| import java.awt.Color | ||
|
|
||
| object WorldColors : Module( | ||
| name = "World Colors", | ||
| description = "Changes the color of the sky", | ||
| defaultTags = setOf(ModuleTag.RENDER) | ||
| ){ | ||
| @JvmStatic | ||
| val customSky by setting("Custom Sky", true) | ||
| @JvmStatic | ||
| val skyColor by setting("Sky Color", Color(255, 24, 75), "The color of your sky") { customSky } | ||
| @JvmStatic | ||
| val customFog by setting("Custom Fog",false) | ||
| @JvmStatic | ||
| val fogColor by setting("Fog Color", Color(255, 24, 75, 255), "The color of your fog") { customFog } | ||
| @JvmStatic | ||
| val customClouds by setting("Custom Clouds", false) | ||
| @JvmStatic | ||
| val cloudColor by setting("Cloud Color", Color(255, 24, 75)) { customClouds } | ||
|
|
||
| @JvmStatic | ||
| fun backgroundColor(base: Vec3d) = | ||
| if (customFog && isEnabled) fogColor.vec3d else base | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.