YUNG-GANG / YUNGs-Menu-Tweaks

A small, lightweight Minecraft mod that makes browsing menus a lot easier
GNU Lesser General Public License v3.0
3 stars 4 forks source link

[1.20.1] Mixin crash when installed with Configured #4

Closed MrCrayfish closed 7 months ago

MrCrayfish commented 7 months ago

Hey Nick, I've tracked a mixin crash (https://github.com/MrCrayfish/Configured/issues/119) down to Configured and your mod. I noticed that you have used a @Redirect in order to override the blit call to render the background texture of AbstractSelectionList. This is causing issues with anything that targets the same blit call with @ModifyArg. I've adapted your code to use @ModifyArg instead which will resolve the issue. Feel free to copy it.

@Mixin(AbstractSelectionList.class)
public class AbstractSelectionListMixin {
    @ModifyArg(method = "render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"), index = 0)
    public ResourceLocation yungsmenutweaks_changeSelectionListBackground(ResourceLocation original) {
        if(YungsMenuTweaksCommon.CONFIG.enableBackgroundTexture && original.equals(Screen.BACKGROUND_LOCATION)) {
            return YungsMenuTweaksCommon.CONFIG.backgroundTexture;
        }
        return original;
    }
}

Cheers

yungnickyoung commented 7 months ago

Yo! Sorry about the invasive mixin, and thanks for the help. I've gone ahead and implemented your ModifyArg approach in v1.0.2. I've also made the same change to the ExperimentsScreenMixin class as well. Did some quick testing and didn't get a crash, but I'll leave this open for you to close upon confirming the crash is fixed.

Thanks again for the help!

MrCrayfish commented 7 months ago

Thanks for the quick response and getting a patch out so soon. I've confirmed the update has resolved the issue.