2018-09-13 12:03:28 -04:00
|
|
|
package noppes.npcs.client.gui;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
2025-07-23 14:22:52 -04:00
|
|
|
import noppes.npcs.client.gui.util.GuiNpcButton;
|
|
|
|
|
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
|
|
|
|
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
|
|
|
|
import noppes.npcs.client.gui.util.ITextfieldListener;
|
|
|
|
|
import noppes.npcs.client.gui.util.SubGuiInterface;
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
public class SubGuiNpcCommand extends SubGuiInterface implements ITextfieldListener {
|
|
|
|
|
public String command;
|
|
|
|
|
|
|
|
|
|
public SubGuiNpcCommand(String command) {
|
|
|
|
|
this.command = command;
|
|
|
|
|
setBackground("menubg.png");
|
|
|
|
|
xSize = 256;
|
|
|
|
|
ySize = 216;
|
|
|
|
|
closeOnEsc = true;
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
public void initGui() {
|
2018-09-13 12:03:28 -04:00
|
|
|
super.initGui();
|
2024-03-13 19:32:22 -04:00
|
|
|
this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 74));
|
2025-03-12 20:12:01 -04:00
|
|
|
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command));
|
|
|
|
|
this.getTextField(4).setMaxStringLength(32767);
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
|
|
|
|
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
|
|
|
|
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
|
|
|
|
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
2024-03-13 19:32:22 -04:00
|
|
|
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
2024-03-13 19:32:22 -04:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
protected void actionPerformed(GuiButton guibutton) {
|
|
|
|
|
int id = guibutton.id;
|
|
|
|
|
if (id == 66) {
|
|
|
|
|
close();
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-22 12:14:04 -05:00
|
|
|
@Override
|
2025-03-12 20:12:01 -04:00
|
|
|
public void close() {
|
|
|
|
|
if (getTextField(4) != null) {
|
2025-01-22 12:14:04 -05:00
|
|
|
unFocused(getTextField(4));
|
|
|
|
|
}
|
|
|
|
|
super.close();
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 20:12:01 -04:00
|
|
|
@Override
|
|
|
|
|
public void unFocused(GuiNpcTextField textfield) {
|
|
|
|
|
if (textfield.id == 4) {
|
|
|
|
|
command = textfield.getText();
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|