Make the sky red when raging

This commit is contained in:
Sollace 2023-10-10 19:06:38 +01:00
parent 8e19ab6a96
commit d4fe4c549d
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 29 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import net.minecraft.util.math.*;
public class WorldRenderDelegate {
public static final WorldRenderDelegate INSTANCE = new WorldRenderDelegate();
private static final Optional<Vec3d> 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<Vec3d> 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) {

View file

@ -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<Vec3d> info) {
WorldRenderDelegate.INSTANCE.getSkyColor(tickDelta).ifPresent(info::setReturnValue);
}
}

View file

@ -57,6 +57,7 @@
"client.MixinAnimalModel",
"client.MixinArmorFeatureRenderer",
"client.MixinCamera",
"client.MixinClientWorld",
"client.MixinEntityRenderDispatcher",
"client.MixinGameRenderer",
"client.MixinHeldItemRenderer",