0

Fabric 1.16.5 Client-Sided Mod Java Coding Language

I'm working on a 1.16.5 Minecraft client-side mod and I am trying to get the scoreboard to be invisible when the Debug HUD is visible. I have a basic mixin to the scoreboard's rendering function but I need to be able to check for whether the DebugHud is visible or not.

Code:

@Mixin(InGameHud.class)
public class MScoreboardHUD {
    @Inject(at = @At("HEAD"), method = "renderScoreboardSidebar")
    private void init(CallbackInfo info) {
        // soon
    }
}
4

1 回答 1

0

回答

UsingMinecraftClient.options.debugEnabled将告诉您 F3 菜单是否处于活动状态。

最终代码

client用作MinecraftClient对象,并info.cancel()取消记分牌渲染

@Mixin(InGameHud.class)
public class MScoreboardHUD {
    @Inject(at = @At("HEAD"), method = "renderScoreboardSidebar")
    private void init(CallbackInfo info) {
        if (client.options.debugEnabled) {
            info.cancel();
        }
    }
}
于 2021-12-11T14:41:28.560 回答