content: package me.earth.earthhack.impl.core.mixins.gui;
  
  import com.mojang.blaze3d.systems.RenderSystem;
  import me.earth.earthhack.api.event.bus.instance.Bus;
  import me.earth.earthhack.impl.event.events.render.CrosshairEvent;
  import me.earth.earthhack.impl.event.events.render.Render2DEvent;
  import net.minecraft.client.MinecraftClient;
  import net.minecraft.client.gui.DrawContext;
  import net.minecraft.client.gui.hud.InGameHud;
  import net.minecraft.client.render.RenderTickCounter;
  import org.lwjgl.opengl.GL11;
  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.callback.CallbackInfo;
  
  @Mixin(InGameHud.class)
  public abstract class MixinInGameHud {
      @Inject(method = "render", at = @At("RETURN"))
      public void renderHook(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci)
      {
          if (MinecraftClient.getInstance().inGameHud.getDebugHud().shouldShowDebugHud())
              return;
  
          RenderSystem.setShaderColor(1, 1, 1, 1);
          RenderSystem.disableDepthTest();
          RenderSystem.enableBlend();
          RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
          RenderSystem.disableCull();
          GL11.glEnable(GL11.GL_LINE_SMOOTH);
          Bus.EVENT_BUS.post(new Render2DEvent(context, tickCounter.getTickDelta(true)));
          RenderSystem.enableDepthTest();
          GL11.glDisable(GL11.GL_LINE_SMOOTH);
      }
  
      @Inject(method = "renderCrosshair", at = @At("HEAD"), cancellable = true)
      public void renderCrosshair(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci)
      {
          CrosshairEvent event = new CrosshairEvent();
          Bus.EVENT_BUS.post(event);
          if (event.isCancelled()) {
              ci.cancel();
          }
      }
  
  }
  