feat: don't display hud indicator if hud is disabled

This commit is contained in:
Erica Marigold 2024-08-16 15:32:41 +05:30
parent 65c15952fa
commit 0a9d2105ef
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -3,6 +3,7 @@ package xyz.devcomp.elytralock.events;
import xyz.devcomp.elytralock.ElytraLock;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.util.Window;
@ -14,7 +15,9 @@ public class HudRenderHandler implements HudRenderCallback {
@Override
public void onHudRender(DrawContext context, RenderTickCounter tickCounter) {
// FIXME: Perhaps don't check whether the elytra is locked on every frame
if (!MinecraftClient.isHudEnabled())
return;
Identifier icon = Identifier.of("elytra-lock",
"textures/gui/" + (ElytraLock.isLocked() ? "locked" : "unlocked") + ".png");