@SideOnly(Side.CLIENT)
public class GuiTab extends GuiScreen {
private GuiTextField pmMSG;
private String selectedPlayer;
private GuiTextField region;
private GuiButton guibutton;
private GuiButton guiRegion;
private GuiButton guiRegion2;
public GuiScreen parentGui;
int u = 0;
private ResourceLocation TextureTab = new ResourceLocation("revivalapi:textures/gui/gui_tab.png");
public GuiTab(GuiScreen par1GuiScreen){
this.parentGui = par1GuiScreen;
}
/**
* Called from the main game loop to update the screen.
*/
public void updateScreen()
{
this.pmMSG.updateCursorCounter();
if(this.pmMSG.getText().equals("Введите сообщение") || this.pmMSG.getText().equals("")){
this.guibutton.enabled = false;
}
else this.guibutton.enabled = true;
this.region.updateCursorCounter();
if(this.region.getText().equals("Имя региона") || this.region.getText().equals("")){
this.guiRegion.enabled = false;
}
else this.guiRegion.enabled = true;
if(this.region.getText().equals("Имя региона") || this.region.getText().equals("")){
this.guiRegion2.enabled = false;
}
else this.guiRegion2.enabled = true;
}
public void SendChatCommand(String tabCommand){
Minecraft.getMinecraft().thePlayer.sendChatMessage(tabCommand);
}
public void initGui() {
Keyboard.enableRepeatEvents(true);
int minus = 40;
int minusTwo = 0;
int yaz = 36;
super.buttonList.clear();
boolean flag = true;
super.buttonList.add(new GuiButton(1, super.width / 8 - minus, super.height / 4 + yaz - 90, 40, 10, I18n.getString("Set home")));
super.buttonList.add(new GuiButton(2, super.width / 8 - minus, super.height / 4 + yaz - 80, 40, 10, I18n.getString("Home")));
super.buttonList.add(new GuiButton(3, super.width / 8 - minus, super.height / 4 + yaz - 70, 40, 10, I18n.getString("Start loc")));
super.buttonList.add(new GuiButton(4, super.width / 8 - minus, super.height / 4 + yaz - 60, 40, 10, I18n.getString("Room")));
super.buttonList.add(new GuiButton(5, super.width / 8 - minus, super.height / 4 + yaz - 50, 40, 10, I18n.getString("Job")));
super.buttonList.add(new GuiButton(7, super.width / 8 - minus, super.height / 4 + yaz - 40, 40, 10, I18n.getString("Бонусы")));
super.buttonList.add(new GuiButton(8, super.width / 8 - minus, super.height / 4 + yaz - 30, 40, 10, I18n.getString("Правила")));
super.buttonList.add(new GuiButton(9, super.width / 8 - minus, super.height / 4 + yaz - 20, 40, 10, I18n.getString("Рецепты")));
super.buttonList.add(new GuiButton(10, super.width / 8 - minus, super.height / 4 + 110, 40, 10, I18n.getString("Пригласить")));
super.buttonList.add(new GuiButton(11, super.width / 8 - minus, super.height / 4 + 120, 40, 10, I18n.getString("Выгнать")));
super.buttonList.add(guiRegion = new GuiButton(12, super.width / 8 - minus, super.height / 4 + 140, 40, 10, I18n.getString("Add Member")));
super.buttonList.add(guiRegion2 = new GuiButton(14, super.width / 8 - minus, super.height / 4 + 150, 40, 10, I18n.getString("Remove Member")));
this.pmMSG = new GuiTextField(this.fontRenderer, super.width / 2 - 0, super.height / 4 + 80, 200, 20);
this.region = new GuiTextField(this.fontRenderer, super.width / 2 - 100, super.height / 4 + 130, 60, 10);
this.region.setMaxStringLength(25);
this.pmMSG.setMaxStringLength(80);
if(u == 0)
this.pmMSG.setText("Введите сообщение");
else this.pmMSG.setText("");
this.region.setText("Имя региона");
//this.pmMSG.getText();
super.buttonList.add(guibutton = new GuiButton(6, super.width / 2 - 144, super.height / 4 + 80, 100, 20, I18n.getString("Отправить ЛС")));
}
protected void actionPerformed(GuiButton par1GuiButton) {
int i = 0;
boolean t = true;
switch(par1GuiButton.id){
case 1:
this.SendChatCommand("/sethome");
break;
case 2:
this.SendChatCommand("/home");
break;
case 3:
this.SendChatCommand("/warp spawn");
break;
case 4:
this.SendChatCommand("/warp room");
break;
case 5:
this.SendChatCommand("/warp job");
break;
case 6:
this.SendChatCommand("pm " + selectedPlayer + " " + this.pmMSG.getText());
this.pmMSG.setText("");
u = 1;
break;
case 7:
Minecraft.getMinecraft().displayGuiScreen(new GuiBonus(this));
break;
case 8:
Minecraft.getMinecraft().displayGuiScreen(null);
break;
case 9:
Minecraft.getMinecraft().displayGuiScreen(GuiCraftGuide.getGuiTab(this));
GuiCraftGuide.getGuiTab(this).parentGui = this;
break;
case 10:
this.SendChatCommand("/home invite " + selectedPlayer);
break;
case 11:
this.SendChatCommand("/home uninvite " + selectedPlayer);
break;
case 12:
this.SendChatCommand("/rg addmember" + region.getText() + selectedPlayer);
break;
case 14:
this.SendChatCommand("/rg removemember" + region.getText() + selectedPlayer);
break;
}
}
/**
* Called when the screen is unloaded. Used to disable keyboard repeat events
*/
public void onGuiClosed()
{
Keyboard.enableRepeatEvents(false);
}
protected void keyTyped(char par1, int par2)
{
this.pmMSG.textboxKeyTyped(par1, par2);
if (par2 == 15)this.pmMSG.setFocused(!this.pmMSG.isFocused());
this.region.textboxKeyTyped(par1, par2);
if(par2 == 15)this.region.setFocused(!this.region.isFocused());
if(Keyboard.isKeyDown(Keyboard.KEY_TAB)) {
Minecraft.getMinecraft().thePlayer.closeScreen();
}
if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
Minecraft.getMinecraft().thePlayer.closeScreen();
}
}
/**
* Called when the mouse is clicked.
*/
protected void mouseClicked(int par1, int par2, int par3)
{
super.mouseClicked(par1, par2, par3);
this.pmMSG.mouseClicked(par1, par2, par3);
this.region.mouseClicked(par1, par2, par3);
}
public void drawBackground(){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPushMatrix();
this.mc.getTextureManager().bindTexture(TextureTab);
GL11.glScalef(super.width/254f, super.height/256f, 1);
this.drawTexturedModalRect(0, 0, 10240, 5120, 1024, 512);
GL11.glPopMatrix();
}
public void drawScreen(int par1, int par2, float par3) {
this.drawBackground();
this.drawCenteredString(super.fontRenderer, "Меню игрока", super.width / 2, 15, 16777215);
int i = 0;
boolean t = true;
this.drawCenteredString(super.fontRenderer, "Alpha Version", super.width / 1 - 127, 30 + 10 * i, 16777215);
this.pmMSG.drawTextBox();
this.region.drawTextBox();
super.drawScreen(par1, par2, par3);
}
}