Skip to content

Commit

Permalink
fix mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
roastpiece committed Mar 15, 2023
1 parent c78ed0f commit 43e2cc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modCompileOnly files("lib/iris-and-sodium-mc1.17-1.1.2+build.9.jar")
modCompileOnly files("lib/iris-mc1.19.2-1.5.2.jar")

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
Expand Down
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);
}
}

0 comments on commit 43e2cc8

Please sign in to comment.