Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Comment thread
emyfops marked this conversation as resolved.
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;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.lambda.mixin.render;

import com.lambda.module.modules.player.Freecam;
import com.lambda.module.modules.render.WorldColors;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
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.ModifyArg;
Expand All @@ -19,4 +22,12 @@ private boolean renderIsThirdPerson(Camera camera) {
private boolean renderSetupTerrainModifyArg(boolean spectator) {
return Freecam.INSTANCE.isEnabled() || spectator;
}

@Redirect(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getSkyColor(Lnet/minecraft/util/math/Vec3d;F)Lnet/minecraft/util/math/Vec3d;"))
private Vec3d redirectSkyColor(ClientWorld world, Vec3d cameraPos, float tickDelta){
if (WorldColors.INSTANCE.isEnabled() && WorldColors.getCustomSky()){
return new Vec3d(WorldColors.getSkyColor().getRed() / 255f, WorldColors.getSkyColor().getGreen() / 255f, WorldColors.getSkyColor().getBlue() / 255f);
}
return world.getSkyColor(cameraPos, tickDelta);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.lambda.module.modules.render

import com.lambda.module.Module
import com.lambda.module.tag.ModuleTag
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("Sky Color", true)
@JvmStatic
val skyColor by setting("Color", Color(255, 24, 75), "The color of your sky") { customSky }
@JvmStatic
val customFog by setting("Fog",false)
@JvmStatic
val fogColor by setting("Color", Color(255, 24, 75, 255), "The color of your horizon") { customFog }
}
1 change: 1 addition & 0 deletions common/src/main/resources/lambda.mixins.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"render.LightmapTextureManagerMixin",
"render.LivingEntityRendererMixin",
"render.RenderLayersMixin",
"render.RenderSystemMixin",
"render.RenderTickCounterMixin",
"render.ScreenHandlerMixin",
"render.VertexBufferMixin",
Expand Down