package com.yolp900.itsjustacharm.client.guis.huds;

import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.ArrayList;
import java.util.List;

public class HudHandler {

	public static List<ModHud> huds = new ArrayList<ModHud>();

	public static HudAffinityInfoPopup affinityInteraction;

	public static void init() {
		affinityInteraction = new HudAffinityInfoPopup();
	}

    @SubscribeEvent
    public void onDraw(RenderGameOverlayEvent.Post event) {
        if(event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
            ScaledResolution resolution = event.getResolution();
            float partialTicks = event.getPartialTicks();

			for (ModHud hud : huds) {
				if (hud instanceof ModHud.ModTickingHud && hud.shouldRender) {
					ModHud.ModTickingHud tickingHud = (ModHud.ModTickingHud) hud;
					tickingHud.tick(resolution, partialTicks);
				}
			}
        }
    }

}
