/*
* Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
* Copyright (C) 2021 cyoung06
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package kr.syeyoung.dungeonsguide.utils;
import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import javax.vecmath.Vector3f;
import java.awt.*;
import java.util.List;
public class RenderUtils {
public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
public static void drawTexturedRect(float x, float y, float width, float height, int filter) {
drawTexturedRect(x, y, width, height, 0.0F, 1.0F, 0.0F, 1.0F, filter);
}
private static float zLevel = 0;
public static int scrollY = 0;
public static boolean allowScrolling;
public static int scrollX = 0;
public static void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font)
{
if (!textLines.isEmpty())
{
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
int i = 0;
for (String s : textLines)
{
int j = font.getStringWidth(s);
if (j > i)
{
i = j;
}
}
int l1 = x + 12;
int i2 = y - 12;
int k = 8;
if (textLines.size() > 1)
{
k += 2 + (textLines.size() - 1) * 10;
}
zLevel = 300.0F;
int l = -267386864;
if (!allowScrolling) {
scrollX = 0;
scrollY = 0;
}
allowScrolling = (i2 < 0);
GlStateManager.pushMatrix();
if (allowScrolling) {
int eventDWheel = Mouse.getDWheel();
if (Keyboard.isKeyDown(42)) {
if (eventDWheel < 0) {
scrollX += 10;
} else if (eventDWheel > 0) {
scrollX -= 10;
}
} else if (eventDWheel < 0) {
scrollY -= 10;
} else if (eventDWheel > 0) {
scrollY += 10;
}
}
GlStateManager.translate(scrollX, scrollY, 0.0F);
drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l);
drawGradientRect(l1 - 3, i2 + k + 3,