Partially fix entity shaders (#294)

* Partially fix entity shaders
This commit is contained in:
Matthew William Noel authored and GitHub committed 2024-02-13 20:57:44 +00:00
1 parent ff65370cc5
commit 445b6a3e68
2 files changed
+31

No files matched your search

@@ -136,6 +136,7 @@ public enum Mixins {
,"shaders.MixinOpenGlHelper"
,"shaders.MixinRender"
,"shaders.MixinRenderGlobal"
,"shaders.MixinRenderManager"
)
),
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.shaders;
import net.coderbot.iris.layer.GbufferPrograms;
import net.coderbot.iris.uniforms.CapturedRenderingState;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RenderManager.class)
public class MixinRenderManager {
@Unique
private static final String DO_RENDER = "Lnet/minecraft/client/renderer/entity/Render;doRender(Lnet/minecraft/entity/Entity;DDDFF)V";
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER))
private void iris$onRenderEntityPre(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
CapturedRenderingState.INSTANCE.setCurrentEntity(entity.getEntityId());
GbufferPrograms.beginEntities();
}
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER, shift = At.Shift.AFTER))
private void iris$onRenderEntityPost(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
CapturedRenderingState.INSTANCE.setCurrentEntity(-1);
GbufferPrograms.endEntities();
}
}