<commit_before>package refinedstorage.gui.grid;

import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.FMLCommonHandler;
import refinedstorage.RefinedStorage;
import refinedstorage.api.network.GridExtractFlags;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.block.EnumGridType;
import refinedstorage.container.ContainerGrid;
import refinedstorage.gui.GuiBase;
import refinedstorage.gui.Scrollbar;
import refinedstorage.gui.grid.sorting.GridSortingName;
import refinedstorage.gui.grid.sorting.GridSortingQuantity;
import refinedstorage.gui.sidebutton.*;
import refinedstorage.integration.jei.IntegrationJEI;
import refinedstorage.network.MessageGridCraftingClear;
import refinedstorage.network.MessageGridInsertHeld;
import refinedstorage.network.MessageGridPatternCreate;
import refinedstorage.network.MessageGridPull;
import refinedstorage.tile.grid.IGrid;
import refinedstorage.tile.grid.TileGrid;
import refinedstorage.tile.grid.WirelessGrid;

import java.io.IOException;
import java.util.*;

public class GuiGrid extends GuiBase {
    public static final GridSortingQuantity SORTING_QUANTITY = new GridSortingQuantity();
    public static final GridSortingName SORTING_NAME = new GridSortingName();

    public static List<ClientStack> ITEMS = new ArrayList<>();
    public static List<ClientStack> SORTED_ITEMS = new ArrayList<>();

    private GuiTextField searchField;

    private ContainerGrid container;
    private IGrid grid;

    private int slotNumber;

    public GuiGrid(ContainerGrid container, IGrid grid) {
        super(container, 227, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 247 : 208);

        setScrollbar(new Scrollbar(174, 20, 12, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 70 : 88));
        getScrollbar().setCanScroll(false);

        this.container = container;
        this.grid = grid;
    }

    @Override
    public void init(int x, int y) {
        if (grid.getRedstoneModeConfig() != null) {
            addSideButton(new SideButtonRedstoneMode(grid.getRedstoneModeConfig()));
        }

        int sx = x + 80 + 1;
        int sy = y + 6 + 1;

        if (searchField == null) {
            searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
            searchField.setEnableBackgroundDrawing(false);
            searchField.setVisible(true);
            searchField.setTextColor(16777215);

            updateSearchFieldFocus(grid.getSearchBoxMode());
        } else {
            searchField.xPosition = sx;
            searchField.yPosition = sy;
        }

        addSideButton(new SideButtonGridViewType(grid));
        addSideButton(new SideButtonGridSortingDirection(grid));
        addSideButton(new SideButtonGridSortingType(grid));
        addSideButton(new SideButtonGridSearchBoxMode(this));

        sortItems();
    }

    public IGrid getGrid() {
        return grid;
    }

    public static void sortItems() {
        GuiScreen screen = Minecraft.getMinecraft().currentScreen;

        if (!(screen instanceof GuiGrid)) {
            return;
        }

        GuiGrid gui = (GuiGrid) screen;

        System.out.println("Resorting!");

        SORTED_ITEMS.clear();

        if (gui.getGrid().isConnected()) {
            SORTED_ITEMS.addAll(ITEMS);

            String query = gui.searchField.getText().trim().toLowerCase();

            Iterator<ClientStack> t = SORTED_ITEMS.iterator();

            while (t.hasNext()) {
                ClientStack stack = t.next();
<commit_msg>Remove print<commit_after>package refinedstorage.gui.grid;

import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.FMLCommonHandler;
import refinedstorage.RefinedStorage;
import refinedstorage.api.network.GridExtractFlags;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.block.EnumGridType;
import refinedstorage.container.ContainerGrid;
import refinedstorage.gui.GuiBase;
import refinedstorage.gui.Scrollbar;
import refinedstorage.gui.grid.sorting.GridSortingName;
import refinedstorage.gui.grid.sorting.GridSortingQuantity;
import refinedstorage.gui.sidebutton.*;
import refinedstorage.integration.jei.IntegrationJEI;
import refinedstorage.network.MessageGridCraftingClear;
import refinedstorage.network.MessageGridInsertHeld;
import refinedstorage.network.MessageGridPatternCreate;
import refinedstorage.network.MessageGridPull;
import refinedstorage.tile.grid.IGrid;
import refinedstorage.tile.grid.TileGrid;
import refinedstorage.tile.grid.WirelessGrid;

import java.io.IOException;
import java.util.*;

public class GuiGrid extends GuiBase {
    public static final GridSortingQuantity SORTING_QUANTITY = new GridSortingQuantity();
    public static final GridSortingName SORTING_NAME = new GridSortingName();

    public static List<ClientStack> ITEMS = new ArrayList<>();
    public static List<ClientStack> SORTED_ITEMS = new ArrayList<>();

    private GuiTextField searchField;

    private ContainerGrid container;
    private IGrid grid;

    private int slotNumber;

    public GuiGrid(ContainerGrid container, IGrid grid) {
        super(container, 227, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 247 : 208);

        setScrollbar(new Scrollbar(174, 20, 12, (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 70 : 88));
        getScrollbar().setCanScroll(false);

        this.container = container;
        this.grid = grid;
    }

    @Override
    public void init(int x, int y) {
        if (grid.getRedstoneModeConfig() != null) {
            addSideButton(new SideButtonRedstoneMode(grid.getRedstoneModeConfig()));
        }

        int sx = x + 80 + 1;
        int sy = y + 6 + 1;

        if (searchField == null) {
            searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
            searchField.setEnableBackgroundDrawing(false);
            searchField.setVisible(true);
            searchField.setTextColor(16777215);

            updateSearchFieldFocus(grid.getSearchBoxMode());
        } else {
            searchField.xPosition = sx;
            searchField.yPosition = sy;
        }

        addSideButton(new SideButtonGridViewType(grid));
        addSideButton(new SideButtonGridSortingDirection(grid));
        addSideButton(new SideButtonGridSortingType(grid));
        addSideButton(new SideButtonGridSearchBoxMode(this));

        sortItems();
    }

    public IGrid getGrid() {
        return grid;
    }

    public static void sortItems() {
        GuiScreen screen = Minecraft.getMinecraft().currentScreen;

        if (!(screen instanceof GuiGrid)) {
            return;
        }

        GuiGrid gui = (GuiGrid) screen;

        SORTED_ITEMS.clear();

        if (gui.getGrid().isConnected()) {
            SORTED_ITEMS.addAll(ITEMS);

            String query = gui.searchField.getText().trim().toLowerCase();

            Iterator<ClientStack> t = SORTED_ITEMS.iterator();

            while (t.hasNext()) {
                ClientStack stack = t.next();

{'fraction_non_alphanumeric': 0.09957468101075807, 'fraction_numerical': 0.009256942707030274, 'mean_word_length': 3.6482558139534884, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '7144539', 'n_tokens_mistral': 2367, 'n_tokens_neox': 2234, 'n_words': 448}