Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.37 KB | None | 0 0
  1. package net.minecraft.client.gui;
  2.  
  3. import java.awt.Desktop;
  4. import java.net.URI;
  5.  
  6. import org.lwjgl.opengl.GL11;
  7. import org.lwjgl.opengl.GL12;
  8.  
  9. import net.minecraft.client.gui.achievement.GuiAchievements;
  10. import net.minecraft.client.gui.achievement.GuiStats;
  11. import net.minecraft.client.multiplayer.WorldClient;
  12. import net.minecraft.client.renderer.OpenGlHelper;
  13. import net.minecraft.client.renderer.RenderHelper;
  14. import net.minecraft.client.renderer.entity.RenderManager;
  15. import net.minecraft.client.resources.I18n;
  16. import net.minecraft.entity.EntityLivingBase;
  17. import net.minecraft.util.EnumChatFormatting;
  18.  
  19. public class GuiIngameMenu extends GuiScreen
  20. {
  21. private int field_146445_a;
  22. private int field_146444_f;
  23. private static final String __OBFID = "CL_00000703";
  24.  
  25. /**
  26. * Adds the buttons (and other controls) to the screen in question.
  27. */
  28. public void initGui()
  29. {
  30. this.field_146445_a = 0;
  31. this.buttonList.clear();
  32. byte var1 = -16;
  33. boolean var2 = true;
  34.  
  35.  
  36. //-----------------------------------------------------------
  37.  
  38. //Nouveaux boutons
  39.  
  40. this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 160 + var1, I18n.format(EnumChatFormatting.DARK_GREEN + "Déconnexion sécurisée", new Object[0])));
  41.  
  42.  
  43. this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 130 + var1, I18n.format(EnumChatFormatting.GOLD + "Revenir en jeu", new Object[0])));
  44.  
  45.  
  46. this.buttonList.add(new GuiButton(2, this.width / 2 - 200, this.height / 4 + 66 + var1, 98, 20, I18n.format(EnumChatFormatting.BLUE + "Site", new Object[0])));
  47.  
  48. this.buttonList.add( new GuiButton(3, this.width / 2 + 102, this.height / 4 + 66 + var1, 98, 20, I18n.format(EnumChatFormatting.DARK_PURPLE + "Craft", new Object[0])));
  49.  
  50. //this.buttonList.add(new GuiButton(10, this.width / 2 - ((mc.getSession().getUsername().length() * 8 + 10) / 2), this.height / 4 + 50 , mc.getSession().getUsername().length() * 8 + 10, 20, I18n.format(EnumChatFormatting.UNDERLINE + mc.getSession().getUsername(), new Object[0])));
  51.  
  52. this.buttonList.add(new GuiButton(0, this.width / 2 - 200, this.height / 4 + 96 + var1, 98, 20, I18n.format(EnumChatFormatting.GREEN + "Options", new Object[0])));
  53.  
  54. this.buttonList.add( new GuiButton(7, this.width / 2 + 102, this.height / 4 + 96 + var1, 98, 20, I18n.format(EnumChatFormatting.YELLOW + "Teamspeak", new Object[0])));
  55.  
  56. this.buttonList.add(new GuiButton(5, this.width / 2 - 180, this.height / 4 + 28 + var1, 98, 20, I18n.format(EnumChatFormatting.DARK_AQUA +"Achivements", new Object[0])));
  57. this.buttonList.add(new GuiButton(6, this.width / 2 + 82, this.height / 4 + 28 + var1, 98, 20, I18n.format(EnumChatFormatting.RED +"Statistiques", new Object[0])));
  58.  
  59. //------------------------------------------------------------
  60.  
  61.  
  62. }
  63.  
  64. protected void actionPerformed(GuiButton p_146284_1_)
  65. {
  66. switch (p_146284_1_.id)
  67. {
  68. case 0:
  69. this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
  70. break;
  71.  
  72. case 1:
  73. if (this.mc.isSingleplayer()){
  74. p_146284_1_.enabled = false;
  75. this.mc.theWorld.sendQuittingDisconnectingPacket();
  76. this.mc.loadWorld((WorldClient)null);
  77. this.mc.displayGuiScreen(new GuiMainMenu());
  78. }
  79.  
  80. else {
  81.  
  82. this.mc.thePlayer.sendChatMessage("/logout");
  83.  
  84. }
  85.  
  86. break;
  87.  
  88. case 2:
  89. try
  90. {
  91. URI var2 = new URI("http://vanadia.fr");
  92.  
  93. if (Desktop.isDesktopSupported())
  94. {
  95. Desktop.getDesktop().browse(var2);
  96. }
  97. }
  98. catch (Exception var7)
  99. {
  100. var7.printStackTrace();
  101. }
  102. break;
  103. case 3:
  104.  
  105. break;
  106. default:
  107. break;
  108.  
  109. case 4:
  110. this.mc.displayGuiScreen((GuiScreen)null);
  111. this.mc.setIngameFocus();
  112. break;
  113.  
  114. case 5:
  115. this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.func_146107_m()));
  116. break;
  117.  
  118. case 6:
  119. this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.func_146107_m()));
  120. break;
  121.  
  122. case 7:
  123. try
  124. {
  125. URI var2 = new URI("ts3server://ts.vanadia.fr?nickname=" + mc.getSession().getUsername());
  126.  
  127. if (Desktop.isDesktopSupported())
  128. {
  129. Desktop.getDesktop().browse(var2);
  130. }
  131. }
  132. catch (Exception var7)
  133. {
  134. var7.printStackTrace();
  135. }
  136. break;
  137. case 10:
  138. try
  139. {
  140. URI var2 = new URI("http://vanadia.fr/membre/" + mc.getSession().getUsername());
  141.  
  142. if (Desktop.isDesktopSupported())
  143. {
  144. Desktop.getDesktop().browse(var2);
  145. }
  146. }
  147. catch (Exception var7)
  148. {
  149. var7.printStackTrace();
  150. }
  151. break;
  152. }
  153. }
  154.  
  155. /**
  156. * Called from the main game loop to update the screen.
  157. */
  158. public void updateScreen()
  159. {
  160. super.updateScreen();
  161. ++this.field_146444_f;
  162. }
  163.  
  164. /**
  165. * Draws the screen and all the components in it.
  166. */
  167. public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
  168. {
  169.  
  170.  
  171. int x = this.width / 2 + 0;
  172. int y = this.height / 2 + 0;
  173. drawPlayer(x, y, 55, -p_73863_2_ + y - 90, +p_73863_1_ - x, this.mc.thePlayer);
  174.  
  175. this.drawDefaultBackground();
  176. this.drawCenteredString(this.fontRendererObj, EnumChatFormatting.GOLD + "- Vanadia Menu -", this.width / 2, 40, 16777215);
  177.  
  178. super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
  179. }
  180.  
  181. public static void drawPlayer(int x, int y, int scale, float roty, float rotx, EntityLivingBase thePlayer)
  182. {
  183. GL11.glEnable(GL11.GL_COLOR_MATERIAL);
  184. GL11.glPushMatrix();
  185. GL11.glTranslatef((float)x, (float)y, 50.0F);
  186. GL11.glScalef((float)(30.0F), (float)30.0F, (float)30.0F);
  187. GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
  188. float var6 = thePlayer.renderYawOffset;
  189. float var7 = thePlayer.rotationYaw;
  190. float var8 = thePlayer.rotationPitch;
  191. float var9 = thePlayer.prevRotationYawHead;
  192. float var10 = thePlayer.rotationYawHead;
  193. GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
  194. RenderHelper.enableStandardItemLighting();
  195. GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
  196. GL11.glRotatef(-((float)Math.atan((double)(roty / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
  197. thePlayer.renderYawOffset = (float)Math.atan((double)(rotx / 40.0F)) * 20.0F;
  198. thePlayer.rotationYaw = (float)Math.atan((double)(rotx / 40.0F)) * 40.0F;
  199. thePlayer.rotationPitch = -((float)Math.atan((double)(roty / 40.0F))) * 20.0F;
  200. thePlayer.rotationYawHead = thePlayer.rotationYaw;
  201. thePlayer.prevRotationYawHead = thePlayer.rotationYaw;
  202. GL11.glTranslatef(0.0F, thePlayer.yOffset, 0.0F);
  203. RenderManager.instance.playerViewY = 180.0F;
  204. RenderManager.instance.func_147940_a(thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
  205. thePlayer.renderYawOffset = var6;
  206. thePlayer.rotationYaw = var7;
  207. thePlayer.rotationPitch = var8;
  208. thePlayer.prevRotationYawHead = var9;
  209. thePlayer.rotationYawHead = var10;
  210. GL11.glPopMatrix();
  211. RenderHelper.disableStandardItemLighting();
  212. GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  213. OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
  214. GL11.glDisable(GL11.GL_TEXTURE_2D);
  215. OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
  216. }
  217.  
  218.  
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement