Advertisement
TNT_Block

mainmenu

Sep 26th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. package de.cryptonicdev.cryptonic.gui;
  2.  
  3. import java.awt.Graphics2D;
  4. import java.awt.image.BufferedImage;
  5. import java.io.File;
  6. import java.io.IOException;
  7.  
  8. import javax.imageio.ImageIO;
  9.  
  10. import org.apache.commons.lang3.Validate;
  11. import org.lwjgl.opengl.GL11;
  12.  
  13. import com.google.common.base.Charsets;
  14.  
  15. import de.cryptonicdev.cryptonic.main.Cryptonic;
  16. import de.cryptonicdev.cryptonic.menu.GuiScreenMenu;
  17. import de.cryptonicdev.cryptonic.particle.ParticleGenerator;
  18. import io.netty.buffer.ByteBuf;
  19. import io.netty.buffer.ByteBufInputStream;
  20. import io.netty.buffer.Unpooled;
  21. import io.netty.handler.codec.base64.Base64;
  22. import net.minecraft.client.gui.Gui;
  23. import net.minecraft.client.gui.GuiButton;
  24. import net.minecraft.client.gui.GuiMultiplayer;
  25. import net.minecraft.client.gui.GuiOptions;
  26. import net.minecraft.client.gui.GuiScreen;
  27. import net.minecraft.client.gui.GuiSelectWorld;
  28. import net.minecraft.client.renderer.GlStateManager;
  29. import net.minecraft.client.renderer.texture.DynamicTexture;
  30. import net.minecraft.client.renderer.texture.TextureUtil;
  31. import net.minecraft.client.resources.I18n;
  32. import net.minecraft.util.ResourceLocation;
  33.  
  34. public class GuiScreenMainMenu extends GuiScreen {
  35.  
  36. private ParticleGenerator gParticle = null;
  37.  
  38. @Override
  39. public void initGui() {
  40. this.gParticle = new ParticleGenerator(this.width / 4, this.width, this.height);
  41. int heightAddition = 8;
  42. this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 2 - 70 + heightAddition,
  43. I18n.format("menu.singleplayer")));
  44. this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 2 - 46 + heightAddition,
  45. I18n.format("menu.multiplayer")));
  46. this.buttonList
  47. .add(new GuiButton(2, this.width / 2 - 100, this.height / 2 - 22 + heightAddition, "Cryptonic-Menü"));
  48. this.buttonList.add(
  49. new GuiButton(3, this.width / 2 - 100, this.height / 2 + 2 + heightAddition, "Cryptonic-Optionen"));
  50. this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 2 + 26 + heightAddition,
  51. "Minecraft-" + I18n.format("menu.options")));
  52. this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 2 + 50 + heightAddition,
  53. I18n.format("menu.quit")));
  54. }
  55.  
  56. @Override
  57. protected void actionPerformed(GuiButton button) throws IOException {
  58. switch (button.id) {
  59.  
  60. case 0: {
  61. mc.displayGuiScreen(new GuiSelectWorld(this));
  62. break;
  63. }
  64.  
  65. case 1: {
  66. mc.displayGuiScreen(new GuiMultiplayer(this));
  67. break;
  68. }
  69.  
  70. case 2: {
  71. mc.displayGuiScreen(new GuiScreenMenu(this));
  72. break;
  73. }
  74.  
  75. case 3: {
  76. break;
  77. }
  78. case 4: {
  79. mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings));
  80. break;
  81. }
  82.  
  83. case 5: {
  84. mc.shutdownMinecraftApplet();
  85. break;
  86. }
  87.  
  88. }
  89. }
  90.  
  91. @Override
  92. public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  93. mc.getTextureManager().bindTexture(new ResourceLocation("cryptonic/background.jpg"));
  94. this.drawScaledCustomSizeModalRect(0, 0, 0F, 0F, width, height, width, height, width, height);
  95. gParticle.drawParticles();
  96. this.drawRect(this.width / 2 - 104, this.height / 2 - 100, this.width / 2 + 104, this.height / 2 + 100,
  97. 0x4d000000);
  98. int widthP = 712;
  99. int heightP = 132;
  100. int size = 6;
  101. GlStateManager.color(1.0F, 1.0F, 1.0F);
  102. mc.getTextureManager().bindTexture(new ResourceLocation("cryptonic/title.png"));
  103. this.drawModalRectWithCustomSizedTexture(this.width / 2 - ((712 / size) / 2), this.height / 2 - 95, 0F, 0F,
  104. 712 / size, 132 / size, 712 / size, 132 / size);
  105. this.drawCenteredString(fontRendererObj, "§b" + Cryptonic.INSTANCE.getVERSION() + " by CryptonicDev",
  106. this.width / 2, this.height / 2 + 100 - 11, -1);
  107. super.drawScreen(mouseX, mouseY, partialTicks);
  108. }
  109.  
  110.  
  111.  
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement