<commit_before>package kihira.tails.client.gui;

import cpw.mods.fml.client.config.GuiUtils;
import kihira.foxlib.client.gui.GuiIconButton;
import kihira.tails.client.PartRegistry;
import kihira.tails.common.LibraryEntryData;
import kihira.tails.common.PartInfo;
import kihira.tails.common.PartsData;
import kihira.tails.common.Tails;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiListExtended;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;

public class LibraryListEntry implements GuiListExtended.IGuiListEntry {

    public LibraryEntryData data;

    public LibraryListEntry(LibraryEntryData libraryEntryData) {
        this.data = libraryEntryData;
    }

    @Override
    public void drawEntry(int index, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean mouseOver) {
        if (data.remoteEntry) {
            Minecraft.getMinecraft().renderEngine.bindTexture(GuiIconButton.iconsTextures);
            GuiIconButton.Icons icon = GuiIconButton.Icons.SERVER;
            GL11.glPushMatrix();
            GL11.glTranslatef(x + listWidth - 16, y + slotHeight - 12, 0F);
            GL11.glScalef(0.8F, 0.8F, 1F);
            GuiUtils.drawTexturedModalRect(0, 0, icon.u, icon.v, 16, 16, 10);
            GL11.glPopMatrix();
        }

        FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRenderer;
        fontRendererObj.drawString((data.partsData.equals(Tails.localPartsData) ? EnumChatFormatting.GREEN + "" + EnumChatFormatting.ITALIC : "") + data.entryName, 5, y + 3, 0xFFFFFF);

        fontRendererObj.setUnicodeFlag(true);
        PartInfo partInfo = data.partsData.getPartInfo(PartsData.PartType.TAIL);
        fontRendererObj.drawString(I18n.format(PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).getUnlocalisedName(partInfo.subid)), x + 5, y + 12, 0xFFFFFF);
        for (int i = 1; i < 4; i++) {
            //libraryPanel.drawGradientRect((int) (listWidth * 1.25) - (10 * i), -1, (int) (listWidth * 1.25) + 10 - (10 * i), 9, partInfo.tints[i - 1], partInfo.tints[i - 1]);
        }

        partInfo = data.partsData.getPartInfo(PartsData.PartType.EARS);
        fontRendererObj.drawString(I18n.format(PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).getUnlocalisedName(partInfo.subid)), x + 5, y + 19, 0xFFFFFF);
        for (int i = 1; i < 4; i++) {
            //libraryPanel.drawGradientRect((int) (listWidth * 1.25) - (10 * i), -1, (int) (listWidth * 1.25) + 10 - (10 * i), 9, partInfo.tints[i - 1], partInfo.tints[i - 1]);
        }

        partInfo = data.partsData.getPartInfo(PartsData.PartType.WINGS);
        fontRendererObj.drawString(I18n.format(PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).getUnlocalisedName(partInfo.subid)), x + 5, y + 26, 0xFFFFFF);
        for (int i = 1; i < 4; i++) {
            //libraryPanel.drawGradientRect((int) (listWidth * 1.25) - (10 * i), -1, (int) (listWidth * 1.25) + 10 - (10 * i), 9, partInfo.tints[i - 1], partInfo.tints[i - 1]);
        }
        fontRendererObj.setUnicodeFlag(false);

        if (data.favourite) {
            Minecraft.getMinecraft().renderEngine.bindTexture(GuiIconButton.iconsTextures);
            GuiIconButton.Icons icon = GuiIconButton.Icons.STAR;
            GL11.glPushMatrix();
            GL11.glTranslatef(x + listWidth - 16, y, 0F);
            GL11.glScalef(0.8F, 0.8F, 1F);
            GuiUtils.drawTexturedModalRect(0, 0, icon.u, icon.v + 32, 16, 16, 10);
            GL11.glPopMatrix();
        }
    }

    @Override
    public boolean mousePressed(int index, int mouseX, int mouseY, int mouseEvent, int mouseSlotX, int mouseSlotY) {
        return false;
    }

    @Override
    public void mouseReleased(int index, int mouseX, int mouseY, int mouseEvent, int mouseSlotX, int mouseSlotY) {}

    public static class NewLibraryListEntry extends LibraryListEntry {

        private final LibraryPanel panel;

        public NewLibraryListEntry(LibraryPanel panel, LibraryEntryData libraryEntryData) {
            super(libraryEntryData);
            this.panel = panel;
        }<commit_msg>Add in colour preview and tidy up code<commit_after>package kihira.tails.client.gui;

import cpw.mods.fml.client.config.GuiUtils;
import kihira.foxlib.client.gui.GuiIconButton;
import kihira.tails.client.PartRegistry;
import kihira.tails.common.LibraryEntryData;
import kihira.tails.common.PartInfo;
import kihira.tails.common.PartsData;
import kihira.tails.common.Tails;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiListExtended;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;

public class LibraryListEntry implements GuiListExtended.IGuiListEntry {

    public LibraryEntryData data;

    public LibraryListEntry(LibraryEntryData libraryEntryData) {
        this.data = libraryEntryData;
    }

    @Override
    public void drawEntry(int index, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean mouseOver) {
        if (data.remoteEntry) {
            Minecraft.getMinecraft().renderEngine.bindTexture(GuiIconButton.iconsTextures);
            GuiIconButton.Icons icon = GuiIconButton.Icons.SERVER;
            GL11.glPushMatrix();
            GL11.glTranslatef(x + listWidth - 16, y + slotHeight - 12, 0F);
            GL11.glScalef(0.8F, 0.8F, 1F);
            GuiUtils.drawTexturedModalRect(0, 0, icon.u, icon.v, 16, 16, 10);
            GL11.glPopMatrix();
        }

        FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRenderer;
        fontRendererObj.drawString((data.partsData.equals(Tails.localPartsData) ? EnumChatFormatting.GREEN + "" + EnumChatFormatting.ITALIC : "") + data.entryName, 5, y + 3, 0xFFFFFF);

        fontRendererObj.setUnicodeFlag(true);
        for (PartsData.PartType type : PartsData.PartType.values()) {
            PartInfo partInfo = data.partsData.getPartInfo(type);
            if (partInfo.hasPart) {
                fontRendererObj.drawString(I18n.format(PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).getUnlocalisedName(partInfo.subid)), x + 5, y + 12 + (8 * type.ordinal()), 0xFFFFFF);
                for (int i = 1; i < 4; i++) {
                    Gui.drawRect(listWidth - (8 * i), y + 13 + (type.ordinal() * 8), listWidth + 7 - (8 * i), y + 20 + (type.ordinal() * 8), partInfo.tints[i - 1]);
                }
            }
        }
        fontRendererObj.setUnicodeFlag(false);

        if (data.favourite) {
            Minecraft.getMinecraft().renderEngine.bindTexture(GuiIconButton.iconsTextures);
            GuiIconButton.Icons icon = GuiIconButton.Icons.STAR;
            GL11.glPushMatrix();
            GL11.glTranslatef(x + listWidth - 16, y, 0F);
            GL11.glScalef(0.8F, 0.8F, 1F);
            GuiUtils.drawTexturedModalRect(0, 0, icon.u, icon.v + 32, 16, 16, 10);
            GL11.glPopMatrix();
        }
    }

    @Override
    public boolean mousePressed(int index, int mouseX, int mouseY, int mouseEvent, int mouseSlotX, int mouseSlotY) {
        return false;
    }

    @Override
    public void mouseReleased(int index, int mouseX, int mouseY, int mouseEvent, int mouseSlotX, int mouseSlotY) {}

    public static class NewLibraryListEntry extends LibraryListEntry {

        private final LibraryPanel panel;

        public NewLibraryListEntry(LibraryPanel panel, LibraryEntryData libraryEntryData) {
            super(libraryEntryData);
            this.panel = panel;
        }
{'fraction_non_alphanumeric': 0.11497021168715933, 'fraction_numerical': 0.026492584611484345, 'mean_word_length': 3.122257053291536, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '5042467', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2510, 'n_words': 503}