-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c78ed0f
commit 43e2cc8
Showing
2 changed files
with
11 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 10 additions & 15 deletions
25
src/main/java/dev/thecodewarrior/hooked/mixin/IrisShadowRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,36 @@ | ||
package dev.thecodewarrior.hooked.mixin; | ||
|
||
import com.teamwizardry.librarianlib.core.util.Client; | ||
import dev.thecodewarrior.hooked.client.HookRenderManager; | ||
import net.coderbot.iris.mixin.WorldRendererAccessor; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.coderbot.iris.pipeline.ShadowRenderer; | ||
import net.minecraft.client.render.BufferBuilderStorage; | ||
import net.minecraft.client.render.Camera; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(targets = "net.coderbot.iris.pipeline.ShadowRenderer") | ||
@Mixin(ShadowRenderer.class) | ||
public class IrisShadowRendererMixin { | ||
@Shadow @Final private BufferBuilderStorage buffers; | ||
|
||
@Inject( | ||
method = "renderShadows", | ||
method = "renderBlockEntities", | ||
at = @At( | ||
value = "INVOKE_STRING", | ||
target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", | ||
target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V", | ||
args = {"ldc=build blockentities"} | ||
), | ||
locals = LocalCapture.CAPTURE_FAILSOFT | ||
) | ||
private void hooked$renderEntities( | ||
WorldRendererAccessor worldRenderer, Camera playerCamera, | ||
CallbackInfo ci, | ||
MinecraftClient client, MatrixStack modelView | ||
VertexConsumerProvider.Immediate par1, MatrixStack modelView, double cameraX, double cameraY, double cameraZ, float tickDelta, boolean hasEntityFrustum, CallbackInfoReturnable<Integer> cir | ||
) { | ||
var cameraPos = client.gameRenderer.getCamera().getPos(); | ||
modelView.translate(-cameraPos.getX(), -cameraPos.getY(), -cameraPos.getZ()); | ||
HookRenderManager.INSTANCE.renderHooks(modelView, Client.getMinecraft().getTickDelta(), buffers.getEntityVertexConsumers()); | ||
modelView.translate(cameraPos.getX(), cameraPos.getY(), cameraPos.getZ()); | ||
modelView.translate(-cameraX, -cameraY, -cameraZ); | ||
HookRenderManager.INSTANCE.renderHooks(modelView, tickDelta, buffers.getEntityVertexConsumers()); | ||
modelView.translate(cameraX, cameraY, cameraZ); | ||
} | ||
} |