Advertisement
Creepinson

Untitled

Jun 24th, 2017
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. package me.creepinson.gui;
  2.  
  3. import java.io.IOException;
  4.  
  5. import org.lwjgl.input.Keyboard;
  6.  
  7. import me.creepinson.capability.Disguise;
  8. import me.creepinson.capability.IDisguise;
  9. import me.creepinson.core.CreepzDisguises;
  10. import me.creepinson.handler.event.EventHandler;
  11. import me.creepinson.lib.util.Utils;
  12. import me.creepinson.lib.util.disguise.DisguiseTypes;
  13. import me.creepinson.lib.util.render.RenderHelper;
  14. import me.creepinson.packet.CustomPacket;
  15. import net.minecraft.client.gui.GuiButton;
  16. import net.minecraft.client.gui.GuiScreen;
  17. import net.minecraft.client.renderer.GlStateManager;
  18. import net.minecraft.util.ResourceLocation;
  19.  
  20. public class GuiMomo extends GuiScreen {
  21.  
  22. public static GuiDisguiseButton type1;
  23.  
  24. public static GuiDisguiseButton type2;
  25.  
  26. public static GuiDisguiseButton type3;
  27.  
  28.  
  29.  
  30. public static final ResourceLocation resource = new ResourceLocation(Utils.MODID, "textures/gui/momo.png");
  31.  
  32.  
  33. @Override
  34. public void initGui() {
  35.  
  36. int i = (this.width - 248) / 2;
  37. int j = (this.height - 166) / 2;
  38. this.buttonList.clear();
  39.  
  40. type1 = this.addButton(new GuiDisguiseButton(0, i, j, 150, 20, "Undisguise"));
  41. type1.visible = true;
  42. type1.enabled = true;
  43. type2 = this.addButton(new GuiDisguiseButton(1, i, j + 25, 150, 20, "Change Disguise to Pig"));
  44. type2.visible = true;
  45. type2.enabled = true;
  46. type3 = this.addButton(new GuiDisguiseButton(2, i, j + 50, 150, 20, "Change Disguise to Creeper"));
  47. type3.visible = true;
  48. type3.enabled = true;
  49.  
  50.  
  51. super.initGui();
  52.  
  53.  
  54.  
  55. }
  56.  
  57.  
  58. @Override
  59. public void updateScreen() {
  60. super.updateScreen();
  61.  
  62. }
  63. @Override
  64. public void onGuiClosed() {
  65. super.onGuiClosed();
  66. Keyboard.enableRepeatEvents(false);
  67.  
  68. }
  69.  
  70. @Override
  71. public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  72.  
  73. type1.drawButton(mc, mouseX, mouseY);
  74. type2.drawButton(mc, mouseX, mouseY);
  75. type3.drawButton(mc, mouseX, mouseY);
  76.  
  77. GlStateManager.color(1.0F, 0.0F, 0.0F, 1.0F);
  78. this.mc.getTextureManager().bindTexture(resource);
  79. int i = (this.width - 248) / 2;
  80. int j = (this.height - 166) / 2;
  81. this.drawTexturedModalRect(i, j, 0, 0, 248, 166);
  82. super.drawScreen(mouseX, mouseY, partialTicks);
  83. }
  84.  
  85.  
  86. @Override
  87. protected void actionPerformed(GuiButton button) throws IOException {
  88. super.actionPerformed(button);
  89.  
  90. if (button.id == 1) {
  91.  
  92. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(1));
  93.  
  94. }
  95. if (button.id == 2) {
  96. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(0));
  97.  
  98. }
  99. if (button.id == 0) {
  100.  
  101. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(2));
  102.  
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement