Advertisement
Benjamin_Loison

GuiTel

Oct 17th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.72 KB | None | 0 0
  1. package fr.altiscraft.altiscraft.common;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import diabolicatrix.project.Base;
  6. import diabolicatrix.project.PacketGetPlayersAndSendMessage;
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.client.gui.GuiButton;
  9. import net.minecraft.client.gui.GuiScreen;
  10. import net.minecraft.client.gui.GuiTextField;
  11. import net.minecraft.entity.player.EntityPlayer;
  12. import net.minecraft.util.EnumChatFormatting;
  13. import net.minecraft.util.ResourceLocation;
  14.  
  15. public class GuiTel extends GuiScreen {
  16.  
  17.     int guiWidth = 350;
  18.     int guiHeight = 200;
  19.  
  20.     private EntityPlayer player = Minecraft.getMinecraft().thePlayer;
  21.    
  22.     private GuiTextField textfield;
  23.     private GuiTextField textefield;
  24.    
  25.     @Override
  26.     public void drawScreen(int x, int y, float ticks) {
  27.         int guix = (width - guiWidth) / 2;
  28.         int guiy = (height - guiHeight) / 2;
  29.         GL11.glColor4f(1, 1, 1, 1);    
  30.         mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/Fondinv.png"));
  31.         drawTexturedModalRect(guix, guiy, 0, 0, guiWidth - 3, 15);
  32.         mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/BackGround.png"));
  33.         drawTexturedModalRect(guix, guiy + 16, 0, 0, guiWidth - 3, 150);
  34.         fontRendererObj.drawString("Tà©là©phone", guix + 5, guiy + 5, 0xFFFFFF);
  35.         this.textfield.drawTextBox();
  36.         this.textefield.drawTextBox();
  37.         super.drawScreen(x, y, ticks);
  38.     }
  39.    
  40.  
  41.    
  42.    
  43.     @Override
  44.     public void initGui() {
  45.             int guiX = (this.width - guiWidth) / 2;
  46.             int guiY = (this.height - guiHeight) / 2;
  47.             buttonList.clear();
  48.             buttonList.add(new GuiAC6(0, guiX + 295, guiY + 144, "FERMER"));
  49.             buttonList.add(new GuiAC6(1, guiX + 2, guiY + 144, "RETOUR"));
  50.             buttonList.add(new GuiAC7(3, guiX + 15, guiY + 80, "ENVOYER"));
  51.             buttonList.add(new GuiAC7(4, guiX + 78, guiY + 80, "POLICE"));
  52.             buttonList.add(new GuiAC7(5, guiX + 141, guiY + 80, "S.A.M.U"));
  53.             buttonList.add(new GuiAC7(6, guiX + 204, guiY + 80, "DEPANNEUR"));
  54.             buttonList.add(new GuiAC7(7, guiX + 267, guiY + 80, "TRANSALTIS"));
  55.             buttonList.add(new GuiAC7(2, guiX + 141, guiY + 105, "STAFF"));
  56.             this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 158, 190, 310, 15);
  57.             textfield.setMaxStringLength(300);
  58.             textfield.setText("");
  59.             this.textefield = new GuiTextField(this.fontRendererObj, this.width / 2 - 158, 251, 120, 15);
  60.             textefield.setMaxStringLength(300);
  61.             textefield.setText("");
  62.             Minecraft.getMinecraft().thePlayer.getDisplayName();
  63.             super.initGui();
  64.  
  65.     }
  66.    
  67.    
  68.     protected void keyTyped(char par1, int par2) {
  69.         super.keyTyped(par1, par2);
  70.         this.textfield.textboxKeyTyped(par1, par2);
  71.         this.textefield.textboxKeyTyped(par1, par2);
  72.     }
  73.  
  74.     protected void mouseClicked(int x, int y, int btn) {
  75.         super.mouseClicked(x, y, btn);
  76.         this.textfield.mouseClicked(x, y, btn);
  77.         this.textefield.mouseClicked(x, y, btn);
  78.        
  79.     }
  80.    
  81.     @Override
  82.     protected void actionPerformed(GuiButton btn) {
  83.         if (btn.id == 0) {
  84.             Minecraft.getMinecraft().displayGuiScreen(null);
  85.         }
  86.        
  87.         else if (btn.id == 1) {
  88.             Minecraft.getMinecraft().displayGuiScreen(new GuiInv());
  89.         }
  90.        
  91.         else if (btn.id == 2) {
  92.             Minecraft.getMinecraft().thePlayer.sendChatMessage("/helpop " + textfield.getText());
  93.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  94.         }
  95.        
  96.         else if (btn.id == 3) {
  97.             Minecraft.getMinecraft().thePlayer.sendChatMessage("/msg" + " " + textefield.getText() + " " + textfield.getText());
  98.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  99.         }
  100.         else if (btn.id == 4) {
  101.             Base.instance.network.sendToServer(new PacketGetPlayersAndSendMessage(EnumChatFormatting.AQUA + "[Gendarmes]" + EnumChatFormatting.DARK_BLUE + " [x:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posX + " z:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posZ + "] " + EnumChatFormatting.RESET + Minecraft.getMinecraft().thePlayer.getDisplayName() + ": " +  textfield.getText(), "Policier"));
  102.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  103.         }
  104.         else if (btn.id == 5) {
  105.             Base.instance.network.sendToServer(new PacketGetPlayersAndSendMessage(EnumChatFormatting.RED + "[SAMU]" + EnumChatFormatting.RED + " [x:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posX + " z:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posZ + "] " + EnumChatFormatting.RESET + Minecraft.getMinecraft().thePlayer.getDisplayName() + ": " +  textfield.getText(), "SAMU"));
  106.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  107.         }
  108.         else if (btn.id == 6) {
  109.             Base.instance.network.sendToServer(new PacketGetPlayersAndSendMessage(EnumChatFormatting.YELLOW + "[Dépanneurs]" + EnumChatFormatting.YELLOW + " [x:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posX + " z:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posZ + "] " + EnumChatFormatting.RESET + Minecraft.getMinecraft().thePlayer.getDisplayName() + ": " +  textfield.getText(), "Garagiste"));
  110.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  111.         }
  112.         else if (btn.id == 7) {
  113.             Base.instance.network.sendToServer(new PacketGetPlayersAndSendMessage(EnumChatFormatting.GOLD + "[TransAltis]" + EnumChatFormatting.GOLD + " [x:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posX + " z:" + Minecraft.getMinecraft().thePlayer.getPlayerCoordinates().posZ + "] " + EnumChatFormatting.RESET + Minecraft.getMinecraft().thePlayer.getDisplayName() + ": " +  textfield.getText(), "TransAltis"));
  114.             Minecraft.getMinecraft().displayGuiScreen(new GuiTel());
  115.         }
  116.        
  117.        
  118.     }
  119.    
  120.     @Override
  121.     public boolean doesGuiPauseGame() {
  122.         return false;
  123.     }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement