<commit_before>/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014 <NAME> (Kihira)
 *
 * See LICENSE for full License
 */

package kihira.foxlib.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

import java.util.List;

public class GuiIconButton extends GuiButton implements ITooltip {

    public static final ResourceLocation iconsTextures = new ResourceLocation("foxlib", "textures/gui/icons.png");

    private final Icons icon;
    private final List<String> tooltip;

    public GuiIconButton(int id, int x, int y, Icons icon, List<String> tooltip) {
        super(id, x, y, 16 ,16, "");
        this.icon = icon;
        this.tooltip = tooltip;
    }

    public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
        if (visible) {
            minecraft.getTextureManager().bindTexture(iconsTextures);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            //Check mouse over
            field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
            int textureOffset = getHoverState(field_146123_n);

            drawTexturedModalRect(xPosition, yPosition, icon.u, icon.v + (textureOffset * 16), 16, 16);
        }
    }

    @Override
    public List<String> getTooltip(int mouseX, int mouseY) {
        return tooltip;
    }

    public enum Icons {
        UNDO(0, 0),
        QUESTION(16, 0),
        EYEDROPPER(32, 0);<commit_msg>Tidy up tooltips for icon buttons<commit_after>/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014 <NAME> (Kihira)
 *
 * See LICENSE for full License
 */

package kihira.foxlib.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import scala.actors.threadpool.Arrays;

import java.util.List;

public class GuiIconButton extends GuiButton implements ITooltip {

    public static final ResourceLocation iconsTextures = new ResourceLocation("foxlib", "textures/gui/icons.png");

    private final Icons icon;
    private final List<String> tooltip;

    public GuiIconButton(int id, int x, int y, Icons icon, String ... tooltips) {
        super(id, x, y, 16 ,16, "");
        this.icon = icon;
        this.tooltip = Arrays.asList(tooltips);
    }

    public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
        if (visible) {
            minecraft.getTextureManager().bindTexture(iconsTextures);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            //Check mouse over
            field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
            int textureOffset = getHoverState(field_146123_n);

            drawTexturedModalRect(xPosition, yPosition, icon.u, icon.v + (textureOffset * 16), 16, 16);
        }
    }

    @Override
    public List<String> getTooltip(int mouseX, int mouseY) {
        return tooltip;
    }

    public enum Icons {
        UNDO(0, 0),
        QUESTION(16, 0),
        EYEDROPPER(32, 0);
{'fraction_non_alphanumeric': 0.11013698630136987, 'fraction_numerical': 0.03561643835616438, 'mean_word_length': 2.925806451612903, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6538229', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1196, 'n_words': 280}