From aa00b1a9b0dba31adefa572533dc2035de77d181 Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 27 Feb 2024 21:20:50 +0000 Subject: [PATCH] Fixed shields rendering on players in the inventory screen --- .../client/render/spell/SpellEffectsRenderDispatcher.java | 8 ++++++++ .../mixin/client/MixinEntityRenderDispatcher.java | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/spell/SpellEffectsRenderDispatcher.java b/src/main/java/com/minelittlepony/unicopia/client/render/spell/SpellEffectsRenderDispatcher.java index 37c4c51b..72d0db23 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/spell/SpellEffectsRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/spell/SpellEffectsRenderDispatcher.java @@ -79,6 +79,10 @@ public class SpellEffectsRenderDispatcher implements SynchronousResourceReloader } public void render(MatrixStack matrices, VertexConsumerProvider vertices, int light, Caster caster, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { + if (!((RenderDispatcherAccessor)client.getEntityRenderDispatcher()).shouldRenderShadows()) { + return; + } + caster.getSpellSlot().forEach(spell -> { render(matrices, vertices, spell, caster, light, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch); return Operation.SKIP; @@ -156,4 +160,8 @@ public class SpellEffectsRenderDispatcher implements SynchronousResourceReloader matrices.pop(); } } + + public interface RenderDispatcherAccessor { + boolean shouldRenderShadows(); + } } diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinEntityRenderDispatcher.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinEntityRenderDispatcher.java index 2d784220..c1954772 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinEntityRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinEntityRenderDispatcher.java @@ -1,11 +1,13 @@ package com.minelittlepony.unicopia.mixin.client; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.minelittlepony.unicopia.client.render.WorldRenderDelegate; +import com.minelittlepony.unicopia.client.render.spell.SpellEffectsRenderDispatcher; import com.minelittlepony.unicopia.entity.Equine; import net.minecraft.client.render.VertexConsumerProvider; @@ -14,7 +16,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; @Mixin(EntityRenderDispatcher.class) -abstract class MixinEntityRenderDispatcher { +abstract class MixinEntityRenderDispatcher implements SpellEffectsRenderDispatcher.RenderDispatcherAccessor { private static final String RENDER = "render(Lnet/minecraft/entity/Entity;DDDFFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"; @@ -29,4 +31,8 @@ abstract class MixinEntityRenderDispatcher { private void afterRender(E entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo info) { Equine.of(entity).ifPresent(eq -> WorldRenderDelegate.INSTANCE.afterEntityRender(eq, matrices, vertexConsumers, light)); } + + @Accessor("renderShadows") + @Override + public abstract boolean shouldRenderShadows(); }