<commit_before>package mcjty.efab.blocks.grid;

import mcjty.efab.EFab;
import mcjty.efab.network.EFabMessages;
import mcjty.efab.network.PacketGetGridStatus;
import mcjty.lib.container.GenericGuiContainer;
import mcjty.lib.gui.Window;
import mcjty.lib.gui.layout.HorizontalAlignment;
import mcjty.lib.gui.layout.PositionalLayout;
import mcjty.lib.gui.widgets.Button;
import mcjty.lib.gui.widgets.Label;
import mcjty.lib.gui.widgets.Panel;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.input.Keyboard;

import java.awt.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

public class GridGui extends GenericGuiContainer<GridTE> {

    public static final int WIDTH = 171;
    public static final int HEIGHT = 176;

    private Button craftButton;
    private Button leftArrow;
    private Button rightArrow;
    private Label timeLeftLabel;

    private static final ResourceLocation mainBackground = new ResourceLocation(EFab.MODID, "textures/gui/grid.png");

    public GridGui(GridTE controller, GridContainer container) {
        super(EFab.instance, EFabMessages.INSTANCE, controller, container, 0, "grid");

        xSize = WIDTH;
        ySize = HEIGHT;
    }

    @Override
    public void initGui() {
        super.initGui();

        Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout())
                .setBackground(mainBackground);

        leftArrow = new Button(mc, this)
                .setName("left")
                .setText("<")
                .setLayoutHint(new PositionalLayout.PositionalHint(82, 45, 13, 18))
                .setVisible(false);
        rightArrow = new Button(mc, this)
                .setName("right")
                .setText(">")
                .setLayoutHint(new PositionalLayout.PositionalHint(112, 45, 13, 18))
                .setVisible(false);
        timeLeftLabel = new Label<>(mc, this)
                .setText("")
                .setHorizontalAlignment(HorizontalAlignment.ALIGN_LEFT)
                .setLayoutHint(new PositionalLayout.PositionalHint(88, 11, 40, 14));
        craftButton = new Button(mc, this)
                .setText("Start")
                .setLayoutHint(new PositionalLayout.PositionalHint(84, 24, 40, 16))
                .addButtonEvent(parent -> craft());

        toplevel.addChild(craftButton).addChild(leftArrow).addChild(rightArrow).addChild(timeLeftLabel);
        toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));

        window = new Window(this, toplevel);

        window.action(EFabMessages.INSTANCE, "left", tileEntity, GridTE.ACTION_LEFT);
        window.action(EFabMessages.INSTANCE, "right", tileEntity, GridTE.ACTION_RIGHT);
    }

    private void craft() {
        if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
            window.sendAction(EFabMessages.INSTANCE, tileEntity, GridTE.ACTION_CRAFT_REPEAT);
        } else {
            window.sendAction(EFabMessages.INSTANCE, tileEntity, GridTE.ACTION_CRAFT);
        }
    }

    private static DecimalFormat fmt = new DecimalFormat("#.##");
    private static DecimalFormat shortFmt = new DecimalFormat("#.0");

    public static String getTime(int ticks, boolean shortForm) {<commit_msg>Replaced several usages of addButtonEvent with a normal event. Renamed addChannelEvent to event<commit_after>package mcjty.efab.blocks.grid;

import mcjty.efab.EFab;
import mcjty.efab.network.EFabMessages;
import mcjty.efab.network.PacketGetGridStatus;
import mcjty.lib.container.GenericGuiContainer;
import mcjty.lib.gui.Window;
import mcjty.lib.gui.layout.HorizontalAlignment;
import mcjty.lib.gui.layout.PositionalLayout;
import mcjty.lib.gui.widgets.Button;
import mcjty.lib.gui.widgets.Label;
import mcjty.lib.gui.widgets.Panel;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.input.Keyboard;

import java.awt.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

public class GridGui extends GenericGuiContainer<GridTE> {

    public static final int WIDTH = 171;
    public static final int HEIGHT = 176;

    private Button craftButton;
    private Button leftArrow;
    private Button rightArrow;
    private Label timeLeftLabel;

    private static final ResourceLocation mainBackground = new ResourceLocation(EFab.MODID, "textures/gui/grid.png");

    public GridGui(GridTE controller, GridContainer container) {
        super(EFab.instance, EFabMessages.INSTANCE, controller, container, 0, "grid");

        xSize = WIDTH;
        ySize = HEIGHT;
    }

    @Override
    public void initGui() {
        super.initGui();

        Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout())
                .setBackground(mainBackground);

        leftArrow = new Button(mc, this)
                .setName("left")
                .setText("<")
                .setLayoutHint(new PositionalLayout.PositionalHint(82, 45, 13, 18))
                .setVisible(false);
        rightArrow = new Button(mc, this)
                .setName("right")
                .setText(">")
                .setLayoutHint(new PositionalLayout.PositionalHint(112, 45, 13, 18))
                .setVisible(false);
        timeLeftLabel = new Label<>(mc, this)
                .setText("")
                .setHorizontalAlignment(HorizontalAlignment.ALIGN_LEFT)
                .setLayoutHint(new PositionalLayout.PositionalHint(88, 11, 40, 14));
        craftButton = new Button(mc, this)
                .setChannel("craft")
                .setText("Start")
                .setLayoutHint(new PositionalLayout.PositionalHint(84, 24, 40, 16));

        toplevel.addChild(craftButton).addChild(leftArrow).addChild(rightArrow).addChild(timeLeftLabel);
        toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));

        window = new Window(this, toplevel);

        window.action(EFabMessages.INSTANCE, "left", tileEntity, GridTE.ACTION_LEFT);
        window.action(EFabMessages.INSTANCE, "right", tileEntity, GridTE.ACTION_RIGHT);
        window.event("craft", (source, params) -> craft());
    }

    private void craft() {
        if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
            window.sendAction(EFabMessages.INSTANCE, tileEntity, GridTE.ACTION_CRAFT_REPEAT);
        } else {
            window.sendAction(EFabMessages.INSTANCE, tileEntity, GridTE.ACTION_CRAFT);
        }
    }

    private static DecimalFormat fmt = new DecimalFormat("#.##");
    private static DecimalFormat shortFmt = new DecimalFormat("#.0");

    public static String getTime(int ticks, boolean shortForm) {
{'fraction_non_alphanumeric': 0.10719508628253875, 'fraction_numerical': 0.011991810470897923, 'mean_word_length': 3.1050420168067228, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4760007', 'n_tokens_mistral': 2111, 'n_tokens_neox': 1981, 'n_words': 413}