<commit_before>package com.creativemd.creativecore.common.gui.controls.gui;

import java.util.ArrayList;

import org.apache.commons.lang3.ArrayUtils;

import com.creativemd.creativecore.common.gui.GuiRenderHelper;
import com.creativemd.creativecore.common.gui.client.style.Style;
import com.creativemd.creativecore.common.gui.event.gui.GuiControlChangedEvent;

import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ChatAllowedCharacters;

public class GuiTextfield extends GuiFocusControl {
	
	public String text = "";
	
	/** also selStart **/
	public int cursorPosition;
	
	/** The current character index that should be used as start of the rendered
	 * text. */
	private int scrollOffset = 0;
	
	public int maxLength = 32;
	
	public int selEnd = 0;
	
	public char[] allowedChars;
	
	private int cursorCounter;
	
	private int enabledColor = 14737632;
	private int disabledColor = 7368816;
	
	public GuiTextfield(String text, int x, int y, int width) {
		this(text, x, y, width, 16);
	}
	
	public GuiTextfield(String text, int x, int y, int width, int height) {
		this(text, text, x, y, width, height);
	}
	
	public GuiTextfield(String name, String text, int x, int y, int width, int height) {
		super(name, x, y, width, height);
		this.text = text;
	}
	
	public GuiTextfield setFloatOnly() {
		this.allowedChars = new char[] { '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.' };
		return this;
	}<commit_msg>Set Gui Textfield to auto-focus<commit_after>package com.creativemd.creativecore.common.gui.controls.gui;

import java.util.ArrayList;

import org.apache.commons.lang3.ArrayUtils;

import com.creativemd.creativecore.common.gui.GuiRenderHelper;
import com.creativemd.creativecore.common.gui.client.style.Style;
import com.creativemd.creativecore.common.gui.event.gui.GuiControlChangedEvent;

import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ChatAllowedCharacters;

public class GuiTextfield extends GuiFocusControl {
	
	public String text = "";
	
	/** also selStart **/
	public int cursorPosition;
	
	/** The current character index that should be used as start of the rendered
	 * text. */
	private int scrollOffset = 0;
	
	public int maxLength = 32;
	
	public int selEnd = 0;
	
	public char[] allowedChars;
	
	private int cursorCounter;
	
	private int enabledColor = 14737632;
	private int disabledColor = 7368816;
	
	public GuiTextfield(String text, int x, int y, int width) {
		this(text, x, y, width, 16);
	}
	
	public GuiTextfield(String text, int x, int y, int width, int height) {
		this(text, text, x, y, width, height);
	}
	
	public GuiTextfield(String name, String text, int x, int y, int width, int height) {
		super(name, x, y, width, height);
		this.text = text;
		this.focused = true;
	}
	
	public GuiTextfield setFloatOnly() {
		this.allowedChars = new char[] { '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.' };
		return this;
	}
{'fraction_non_alphanumeric': 0.12138896994455792, 'fraction_numerical': 0.018675226145316602, 'mean_word_length': 4.529032258064516, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6003685', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1115, 'n_words': 302}