package com.leisuretimedock.blasttravelreborn.util;

import com.leisuretimedock.blasttravelreborn.BlastTravelReborn;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;

public enum BTRUtil {;
	public static final ResourceLocation CANNON_OVERLAY_TEX = BlastTravelReborn.id("textures/misc/cannon_overlay.png");

	public static void renderCannonHubOverlay(GuiGraphics gui, float scale) {
		int scaledWidth = gui.guiWidth(), scaledHeight = gui.guiHeight();
		float f = (float)Math.min(scaledWidth, scaledHeight);
		float g = f;
		float h = Math.min((float)scaledWidth / f, (float)scaledHeight / g) * scale;
		int i = Mth.floor(f * h);
		int j = Mth.floor(g * h);
		int k = (scaledWidth - i) / 2;
		int l = (scaledHeight - j) / 2;
		int m = k + i;
		int n = l + j;
		gui.blit(CANNON_OVERLAY_TEX, k, l, -90, 0.0F, 0.0F, i, j, i, j);
		gui.fill(RenderType.guiOverlay(), 0, n, scaledWidth, scaledHeight, -90, -16777216);
		gui.fill(RenderType.guiOverlay(), 0, 0, scaledWidth, l, -90, -16777216);
		gui.fill(RenderType.guiOverlay(), 0, l, k, n, -90, -16777216);
		gui.fill(RenderType.guiOverlay(), m, l, scaledWidth, n, -90, -16777216);
	}

}
