Skip to content

Instantly share code, notes, and snippets.

@jmgrosen
Created September 24, 2011 23:27
Show Gist options
  • Select an option

  • Save jmgrosen/1239987 to your computer and use it in GitHub Desktop.

Select an option

Save jmgrosen/1239987 to your computer and use it in GitHub Desktop.
Code for gui
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import de.matthiasmann.twl.TextArea;
public class mod_TestGui extends BaseMod {
public KeyBinding keyTest = new KeyBinding("keyTest", 24);
public WidgetSimplewindow mainscreen;
@Override
public String Version() {
return "1.8.1";
}
public mod_TestGui() {
ModLoader.RegisterKey(this, this.keyTest, false);
ModLoader.AddLocalization("keyTest", "Objectives");
System.out.println("hi peoples");
TextArea[] textareas = new TextArea[20];
for (int i = 0; i < 20; i++) {
textareas[i] = GuiApiHelper.makeTextArea("<a href=\"" + i
+ "\">Hi peoples, " + i + "</a>", true);
textareas[i].addCallback(new MyTextAreaCallback());
}
WidgetSinglecolumn mainBaseWidget = new WidgetSinglecolumn(textareas);
for (int i = 0; i < 20; i++) {
mainBaseWidget.heightOverrideExceptions.put(textareas[i], 0);
}
mainscreen = new WidgetSimplewindow(mainBaseWidget, "Objectives");
}
public void KeyboardEvent(KeyBinding keybinding) {
if (keybinding == this.keyTest) {
// EntityPlayer player = ModLoader.getMinecraftInstance().thePlayer;
System.out.println("hi");
// ModLoader.OpenGUI(player, new GuiObjectivesMain());
GuiModScreen.show(mainscreen);
}
}
private class MyTextAreaCallback implements TextArea.Callback {
private MyTextAreaCallback() {
}
@Override
public void handleLinkClicked(String link) {
System.out.println("hello, " + link + " was clicked");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment