Skip to content

Commit 0beeb3a

Browse files
committed
Fix WorldColor mixins
1 parent 23180e6 commit 0beeb3a

File tree

5 files changed

+32
-56
lines changed

5 files changed

+32
-56
lines changed

src/main/java/com/lambda/mixin/render/BackgroundRendererMixin.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.lambda.module.modules.render.WorldColors;
2121
import net.minecraft.client.render.BackgroundRenderer;
2222
import net.minecraft.util.math.Vec3d;
23+
import net.minecraft.world.biome.Biome;
2324
import org.spongepowered.asm.mixin.Mixin;
2425
import org.spongepowered.asm.mixin.injection.At;
2526
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -40,16 +41,22 @@
4041
public class BackgroundRendererMixin {
4142
@Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getX()D"))
4243
private static double redirectRed(Vec3d baseColor) {
43-
return WorldColors.backgroundColor(baseColor).getX();
44+
return WorldColors.fogOfWarColor(baseColor).getX();
4445
}
4546

4647
@Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getY()D"))
4748
private static double redirectGreen(Vec3d baseColor) {
48-
return WorldColors.backgroundColor(baseColor).getY();
49+
return WorldColors.fogOfWarColor(baseColor).getY();
4950
}
5051

5152
@Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;getZ()D"))
5253
private static double redirectBlue(Vec3d baseColor) {
53-
return WorldColors.backgroundColor(baseColor).getZ();
54+
return WorldColors.fogOfWarColor(baseColor).getZ();
5455
}
56+
57+
@Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/Biome;getWaterFogColor()I"))
58+
private static int redirectWaterFogColor(Biome biome) {
59+
return WorldColors.waterFogColor(biome.getWaterFogColor());
60+
}
61+
5562
}

src/main/java/com/lambda/mixin/render/RenderSystemMixin.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/main/java/com/lambda/mixin/world/ClientWorldMixin.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ private void onRemoveEntity(int entityId, Entity.RemovalReason removalReason, Ca
4848
}
4949

5050
@Inject(method = "getCloudsColor", at = @At("HEAD"), cancellable = true)
51-
private void getCloudsColorInject(float tickDelta, CallbackInfoReturnable<Vec3d> cir) {
51+
private void getCloudsColorInject(float tickDelta, CallbackInfoReturnable<Integer> cir) {
5252
if (WorldColors.INSTANCE.isEnabled() && WorldColors.getCustomClouds()) {
53-
cir.setReturnValue(ColorKt.getVec3d(WorldColors.getCloudColor()));
53+
int rgb = WorldColors.getCloudColor().getRGB() & 0xFFFFFF;
54+
cir.setReturnValue(rgb);
5455
}
5556
}
5657

5758
@Inject(method = "getSkyColor", at = @At("HEAD"), cancellable = true)
58-
private void getSkyColorInject(Vec3d cameraPos, float tickDelta, CallbackInfoReturnable<Vec3d> cir) {
59+
private void getSkyColorInject(Vec3d cameraPos, float tickDelta, CallbackInfoReturnable<Integer> cir) {
5960
if (WorldColors.INSTANCE.isEnabled() && WorldColors.getCustomSky()) {
60-
cir.setReturnValue(ColorKt.getVec3d(WorldColors.getSkyColor()));
61+
int rgb = WorldColors.getSkyColor().getRGB() & 0xFFFFFF;
62+
cir.setReturnValue(rgb);
6163
}
6264
}
6365

66+
6467
@Inject(method = "handleBlockUpdate", at = @At("HEAD"), cancellable = true)
6568
private void handleBlockUpdateInject(BlockPos pos, BlockState newState, int flags, CallbackInfo ci) {
6669
if (EventFlow.post(new WorldEvent.BlockUpdate.Server(pos, newState)).isCanceled()) ci.cancel();

src/main/kotlin/com/lambda/module/modules/render/WorldColors.kt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.awt.Color
2525

2626
object WorldColors : Module(
2727
name = "WorldColors",
28-
description = "Changes the color of the sky",
28+
description = "Changes the color of the sky, clouds and fog",
2929
tag = ModuleTag.RENDER,
3030
) {
3131
@JvmStatic
@@ -35,10 +35,10 @@ object WorldColors : Module(
3535
val skyColor by setting("Sky Color", Color(255, 24, 75), "The color of your sky") { customSky }
3636

3737
@JvmStatic
38-
val customFog by setting("Custom Fog", false)
38+
val customFogOfWar by setting("Custom Fog of War", false)
3939

4040
@JvmStatic
41-
val fogColor by setting("Fog Color", Color(255, 24, 75, 255), "The color of your fog") { customFog }
41+
val fogOfWarColor by setting("Fog of War Color", Color(255, 24, 75, 255), "The color of your fog") { customFogOfWar }
4242

4343
@JvmStatic
4444
val customClouds by setting("Custom Clouds", false)
@@ -47,6 +47,16 @@ object WorldColors : Module(
4747
val cloudColor by setting("Cloud Color", Color(255, 24, 75)) { customClouds }
4848

4949
@JvmStatic
50-
fun backgroundColor(base: Vec3d) =
51-
if (customFog && isEnabled) fogColor.vec3d else base
50+
val customWaterFog by setting("Custom Water Fog", true)
51+
52+
@JvmStatic
53+
val waterFogColor by setting("Water Fog Color", Color(255, 24, 75, 255), "The color of your water fog") { customWaterFog }
54+
55+
@JvmStatic
56+
fun fogOfWarColor(base: Vec3d) =
57+
if (customFogOfWar && isEnabled) fogOfWarColor.vec3d else base
58+
59+
@JvmStatic
60+
fun waterFogColor(base: Int): Int =
61+
if (customWaterFog && isEnabled) this.waterFogColor.rgb else base
5262
}

src/main/resources/lambda.mixins.common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"render.LivingEntityRendererMixin",
4747
"render.PlayerListHudMixin",
4848
"render.RenderLayersMixin",
49-
"render.RenderSystemMixin",
5049
"render.ScreenHandlerMixin",
5150
"render.SplashOverlayMixin",
5251
"render.SplashOverlayMixin$LogoTextureMixin",

0 commit comments

Comments
 (0)