package me.deftware.client.framework.wrappers.gui.list;

import me.deftware.client.framework.wrappers.render.IFontRenderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.EntryListWidget;

@SuppressWarnings("ALL")
public class StringList extends EntryListWidget {

	public StringList(int width, int height, int top, int bottom, int itemHeight) {
		super(MinecraftClient.getInstance(), width, height, top, bottom, itemHeight);
	}

	public void clear() {
		this.children().clear();
	}

	public void addItem(String text) {
		this.children().add(new StringEntry(text));
	}

	public void doDraw(int mouseX, int mouseY, float delta) {
		this.render(mouseX, mouseY, delta);
	}

	@Override
	public int getRowWidth() {
		return width - 2;
	}

	@Override
	protected int getScrollbarPosition() {
		return width - 6;
	}

	public static class StringEntry extends EntryListWidget.Entry {

		private String string;

		public StringEntry(String string) {
			this.string = string;
		}

		public void render(int index, int y, int x, int width, int height, int mouseX, int mouseY, boolean hovering, float delta) {
			String render = string;
			if (IFontRenderer.getStringWidth(render) > width) {
				render = "";
				for (String s : string.split("")) {
					if (IFontRenderer.getStringWidth(render + s + "...") < width - 6) {
						render += s;
					} else {
						render += "...";
						break;
					}
				}
			}
			IFontRenderer.drawString(render, x, y, 0xFFFFFF);
		}

	}

}
@@ -99,28 +99,135 @@
 ers.
-render.IFontRenderer
+gui.IGuiScreen;%0Aimport me.deftware.client.framework.wrappers.render.IFontRenderer;%0Aimport me.deftware.mixin.imp.IMixinGuiScreen
 ;%0Aim
@@ -804,24 +804,136 @@
 delta);%0A%09%7D%0A%0A
+%09public void addToEventListener(IGuiScreen screen) %7B%0A%09%09((IMixinGuiScreen) screen).getEventList().add(this);%0A%09%7D%0A%0A
 %09@Override%0A%09

Add event listener method