// Path: src/main/java/net/nickac/lithium/frontend/mod/utils/MiscUtils.java
// public class MiscUtils {
// 	public static String stringToStars(String input) {
// 		char[] ca = new char[input.length()];
// 		Arrays.fill(ca, '*');
// 		return new String(ca);
// 	}
// 
// 	public static boolean isCenteredX(LControl c) {
// 		return c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.VERTICAL;
// 	}
// 
// 	public static boolean isCenteredY(LControl c) {
// 		return c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.HORIZONTAL;
// 	}
// 
// 	public static int ConvertRange(int originalStart, int originalEnd, int newStart, int newEnd, int value) {
// 		double scale = (double) (newEnd - newStart) / (originalEnd - originalStart);
// 		return (int) (newStart + ((value - originalStart) * scale));
// 	}
// 
// 	public static String getURLFileExt(String url) {
// 		if (url.contains(".")) {
// 			return url.substring(url.lastIndexOf("."));
// 		}
// 		return "";
// 
// 	}
// }


import net.minecraft.client.gui.GuiPageButtonList;
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;
import net.minecraft.util.math.MathHelper;
import net.nickac.lithium.frontend.mod.utils.MiscUtils;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
	/**
	 * returns the text between the cursor and selectionEnd
	 */
	public String getSelectedText() {
		int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
		int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
		return this.text.substring(i, j);
	}

	public void setValidator(Predicate<String> theValidator) {
		this.validator = theValidator;
	}

	/**
	 * Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
	 */
	public void writeText(String textToWrite) {
		String s = "";
		String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
		int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
		int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
		int k = this.maxStringLength - this.text.length() - (i - j);

		if (!this.text.isEmpty()) {
			s = s + this.text.substring(0, i);
		}

		int l;

		if (k < s1.length()) {
// Path: src/main/java/net/nickac/lithium/frontend/mod/utils/MiscUtils.java
// public class MiscUtils {
// 	public static String stringToStars(String input) {
// 		char[] ca = new char[input.length()];
// 		Arrays.fill(ca, '*');
// 		return new String(ca);
// 	}
// 
// 	public static boolean isCenteredX(LControl c) {
// 		return c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.VERTICAL;
// 	}
// 
// 	public static boolean isCenteredY(LControl c) {
// 		return c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.HORIZONTAL;
// 	}
// 
// 	public static int ConvertRange(int originalStart, int originalEnd, int newStart, int newEnd, int value) {
// 		double scale = (double) (newEnd - newStart) / (originalEnd - originalStart);
// 		return (int) (newStart + ((value - originalStart) * scale));
// 	}
// 
// 	public static String getURLFileExt(String url) {
// 		if (url.contains(".")) {
// 			return url.substring(url.lastIndexOf("."));
// 		}
// 		return "";
// 
// 	}
// }


// Path: src/main/java/net/nickac/lithium/frontend/mod/ui/NickGuiTextField.java
import net.minecraft.client.gui.GuiPageButtonList;
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;
import net.minecraft.util.math.MathHelper;
import net.nickac.lithium.frontend.mod.utils.MiscUtils;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;

	/**
	 * returns the text between the cursor and selectionEnd
	 */
	public String getSelectedText() {
		int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
		int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
		return this.text.substring(i, j);
	}

	public void setValidator(Predicate<String> theValidator) {
		this.validator = theValidator;
	}

	/**
	 * Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
	 */
	public void writeText(String textToWrite) {
		String s = "";
		String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
		int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
		int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
		int k = this.maxStringLength - this.text.length() - (i - j);

		if (!this.text.isEmpty()) {
			s = s + this.text.substring(0, i);
		}

		int l;

		if (k < s1.length()) {
			s = s + s1.substring(0, k);