diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java index b5e043f2..30472c2c 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/WorldRenderDelegate.java @@ -25,6 +25,7 @@ import net.minecraft.util.math.*; public class WorldRenderDelegate { public static final WorldRenderDelegate INSTANCE = new WorldRenderDelegate(); + private static final Optional RED_SKY_COLOR = Optional.of(new Vec3d(1, 0, 0)); private final EntityReplacementManager disguiseLookup = new EntityReplacementManager(); private final EntityDisguiseRenderer disguiseRenderer = new EntityDisguiseRenderer(this); @@ -35,6 +36,13 @@ public class WorldRenderDelegate { final MinecraftClient client = MinecraftClient.getInstance(); + public Optional getSkyColor(float tickDelta) { + if (EquinePredicates.RAGING.test(client.player)) { + return RED_SKY_COLOR; + } + return Optional.empty(); + } + public boolean beforeEntityRender(Entity entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertices, int light) { diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientWorld.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientWorld.java new file mode 100644 index 00000000..66d8ae34 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientWorld.java @@ -0,0 +1,20 @@ +package com.minelittlepony.unicopia.mixin.client; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import com.minelittlepony.unicopia.client.render.WorldRenderDelegate; + +import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.Vec3d; + +@Mixin(ClientWorld.class) +abstract class MixinClientWorld { + + @Inject(method = "getSkyColor", at = @At("HEAD"), cancellable = true) + public void getSkyColor(Vec3d cameraPos, float tickDelta, CallbackInfoReturnable info) { + WorldRenderDelegate.INSTANCE.getSkyColor(tickDelta).ifPresent(info::setReturnValue); + } +} diff --git a/src/main/resources/unicopia.mixin.json b/src/main/resources/unicopia.mixin.json index c3d70dca..06d71429 100644 --- a/src/main/resources/unicopia.mixin.json +++ b/src/main/resources/unicopia.mixin.json @@ -57,6 +57,7 @@ "client.MixinAnimalModel", "client.MixinArmorFeatureRenderer", "client.MixinCamera", + "client.MixinClientWorld", "client.MixinEntityRenderDispatcher", "client.MixinGameRenderer", "client.MixinHeldItemRenderer",