From 62b70c2a7f36bbb604d8eaa1bf2cdecab98442a9 Mon Sep 17 00:00:00 2001 From: comp500 Date: Mon, 1 Aug 2022 17:45:05 +0100 Subject: [PATCH] Fix mixin in remapped dev environment (fixes #127) Apparently remap = true doesn't yell at you about names it doesn't find mappings for anymore! --- .../sodium/MixinChunkRenderRebuildTask.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/link/infra/indium/mixin/sodium/MixinChunkRenderRebuildTask.java b/src/main/java/link/infra/indium/mixin/sodium/MixinChunkRenderRebuildTask.java index fb6a6a5..53b5177 100644 --- a/src/main/java/link/infra/indium/mixin/sodium/MixinChunkRenderRebuildTask.java +++ b/src/main/java/link/infra/indium/mixin/sodium/MixinChunkRenderRebuildTask.java @@ -1,13 +1,7 @@ package link.infra.indium.mixin.sodium; -import link.infra.indium.other.AccessBlockRenderer; -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.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - import link.infra.indium.Indium; +import link.infra.indium.other.AccessBlockRenderer; import link.infra.indium.other.AccessChunkRenderCacheLocal; import link.infra.indium.renderer.render.TerrainRenderContext; import me.jellysquid.mods.sodium.client.gl.compile.ChunkBuildContext; @@ -23,6 +17,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.BlockRenderView; +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.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * The main injection point into Sodium - here we stop Sodium from rendering FRAPI block models, and do it ourselves @@ -43,10 +42,7 @@ public void afterPerformBuild(ChunkBuildContext buildContext, CancellationSource context.release(); } - // Can't specify the arguments here, as the arguments wouldn't get remapped - // and remap = true fails as it tries to find a mapping for renderBlock - // so I just let MinecraftDev yell at me here - @Redirect(method = "performBuild", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/pipeline/BlockRenderer;renderModel"), remap = false) + @Redirect(method = "performBuild", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/pipeline/BlockRenderer;renderModel(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/render/model/BakedModel;Lme/jellysquid/mods/sodium/client/render/chunk/compile/buffers/ChunkModelBuilder;ZJ)Z")) public boolean onRenderBlock(BlockRenderer blockRenderer, BlockRenderView world, BlockState state, BlockPos pos, BlockPos origin, BakedModel model, ChunkModelBuilder buffers, boolean cull, long seed, ChunkBuildContext buildContext, CancellationSource cancellationSource) { // We need to get the model with a bit more context than BlockRenderer has, so we do it here