Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
1,530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. package fr.twitmund.gui;
  2.  
  3. import java.awt.Color;
  4.  
  5. import com.mojang.realmsclient.client.Request.Get;
  6.  
  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.renderer.GlStateManager;
  11. import net.minecraft.client.renderer.OpenGlHelper;
  12. import net.minecraft.client.renderer.RenderHelper;
  13. import net.minecraft.client.renderer.entity.RenderManager;
  14. import net.minecraft.entity.EntityLivingBase;
  15. import net.minecraft.util.ResourceLocation;;
  16.  
  17. public class OgabeGuiMenu extends GuiScreen {
  18.  
  19. private final ResourceLocation background = new ResourceLocation("textures/gui/OgabeGui/GuiOgabe.png");
  20.  
  21. //248 :/166
  22. private final int xSize = 248;
  23. private final int ySize = 166;
  24.  
  25. private int guiLeft;
  26. private int guiTop;
  27.  
  28. private Minecraft minecraft;
  29.  
  30. public OgabeGuiMenu(Minecraft mc){
  31. minecraft = mc;
  32.  
  33.  
  34. }
  35.  
  36. public void initGui(){
  37. guiLeft = (this.width - this.xSize) / 2;
  38. guiTop = (this.height - this.ySize) / 2;
  39.  
  40.  
  41. buttonList.add(new GuiButton(0, guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 30), 50, 20, "§bSpawn"));
  42. buttonList.add(new GuiButton(1, guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 50), 50, 20, "§bTest"));
  43. buttonList.add(new GuiButton(2, guiLeft +(248 / 2 - 122) , guiTop + 2, 20, 20, "§c§lX"));
  44. }
  45.  
  46. public void actionPerformed(GuiButton button){
  47. if(button.id == 0 ){
  48. this.mc.thePlayer.sendChatMessage(":sethome maisons");
  49. }
  50. else if(button.id == 1 ){
  51. this.mc.thePlayer.sendChatMessage(":home maisons");
  52.  
  53. }
  54. if(button.id == 2){
  55. this.mc.displayGuiScreen((GuiScreen)null);
  56. this.mc.setIngameFocus();
  57. }
  58.  
  59.  
  60. }
  61.  
  62. public void drawScreen(int mouseX, int mouseY, float partialTicks){
  63.  
  64. this.drawBackgroundImage();
  65. drawText();
  66. drawEntityOnScreen(guiLeft + 110, guiTop + 100 ,40 , (guiLeft + 110) - mouseX, (guiTop + 40) - mouseY ,this.mc.thePlayer );
  67. super.drawScreen(mouseX, mouseY, partialTicks);
  68.  
  69.  
  70. }
  71. public void drawBackgroundImage(){
  72. GlStateManager.pushMatrix();
  73. GlStateManager.color(1.0F,1.0F,1.0F,1.0F);
  74.  
  75. this.minecraft.getTextureManager().bindTexture(background);
  76. drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
  77. GlStateManager.popMatrix();
  78.  
  79. }
  80.  
  81.  
  82. public void drawText(){
  83. //drawString
  84. //drawSkinCeteredString
  85. //drawStringWithShadow
  86. drawCenteredString(fontRendererObj, "§fTu as §4§l" + this.mc.thePlayer.getHealth() / 2 + " " +"§fde coeur ", guiLeft +(248 / 2 - 5) , guiTop + 150 + 2,0x87E990 );
  87. //drawString(fontRendererObj, "Tu a " + this.mc.thePlayer.getAbsorptionAmount() / 2 + " " +"de coeur d'absorbtion", guiLeft +(248 / 2 - 120) , guiTop + (166 / 2 - 50),0x87E990 );
  88. }
  89.  
  90. public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent){
  91. GlStateManager.enableColorMaterial();
  92. GlStateManager.pushMatrix();
  93. GlStateManager.translate((float)posX, (float)posY, 50.0F);
  94. GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
  95. GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
  96. float f = ent.renderYawOffset;
  97. float f1 = ent.rotationYaw;
  98. float f2 = ent.rotationPitch;
  99. float f3 = ent.prevRotationYawHead;
  100. float f4 = ent.rotationYawHead;
  101. GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
  102. RenderHelper.enableStandardItemLighting();
  103. GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
  104. GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
  105. ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
  106. ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
  107. ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
  108. ent.rotationYawHead = ent.rotationYaw;
  109. ent.prevRotationYawHead = ent.rotationYaw;
  110. GlStateManager.translate(0.0F, 0.0F, 0.0F);
  111. RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
  112. rendermanager.setPlayerViewY(180.0F);
  113. rendermanager.setRenderShadow(false);
  114. rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
  115. rendermanager.setRenderShadow(true);
  116. ent.renderYawOffset = f;
  117. ent.rotationYaw = f1;
  118. ent.rotationPitch = f2;
  119. ent.prevRotationYawHead = f3;
  120. ent.rotationYawHead = f4;
  121. GlStateManager.popMatrix();
  122. RenderHelper.disableStandardItemLighting();
  123. GlStateManager.disableRescaleNormal();
  124. GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
  125. GlStateManager.disableTexture2D();
  126. GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
  127. }
  128.  
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement