Advertisement
Creepinson

Untitled

Jun 24th, 2017
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 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. public static GuiSliderFixed type;
  29.  
  30.  
  31.  
  32.  
  33. public static final ResourceLocation resource = new ResourceLocation(Utils.MODID, "textures/gui/momo.png");
  34.  
  35.  
  36. @Override
  37. public void initGui() {
  38.  
  39. int i = (this.width - 248) / 2;
  40. int j = (this.height - 166) / 2;
  41. this.buttonList.clear();
  42.  
  43. // type1 = this.addButton(new GuiDisguiseButton(0, i, j, 150, 20, "Undisguise"));
  44. // type1.visible = true;
  45. // type1.enabled = true;
  46. // type2 = this.addButton(new GuiDisguiseButton(1, i, j + 25, 150, 20, "Change Disguise to Pig"));
  47. // type2.visible = true;
  48. // type2.enabled = true;
  49. // type3 = this.addButton(new GuiDisguiseButton(2, i, j + 50, 150, 20, "Change Disguise to Creeper"));
  50. // type3.visible = true;
  51. // type3.enabled = true;
  52. type = this.addButton(new GuiSliderFixed(2, i, j + 50, "Change Disguise", 0, 2, 0));
  53. type.visible = true;
  54. type.enabled = true;
  55.  
  56.  
  57. super.initGui();
  58.  
  59.  
  60.  
  61. }
  62.  
  63.  
  64. @Override
  65. public void updateScreen() {
  66. super.updateScreen();
  67.  
  68. }
  69. @Override
  70. public void onGuiClosed() {
  71. super.onGuiClosed();
  72. Keyboard.enableRepeatEvents(false);
  73.  
  74. }
  75.  
  76. @Override
  77. public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  78. //
  79. // type1.drawButton(mc, mouseX, mouseY);
  80. // type2.drawButton(mc, mouseX, mouseY);
  81. // type3.drawButton(mc, mouseX, mouseY);
  82.  
  83. type.drawButton(mc, mouseX, mouseY);
  84.  
  85. GlStateManager.color(1.0F, 0.0F, 0.0F, 1.0F);
  86. this.mc.getTextureManager().bindTexture(resource);
  87. int i = (this.width - 248) / 2;
  88. int j = (this.height - 166) / 2;
  89. this.drawTexturedModalRect(i, j, 0, 0, 248, 166);
  90. super.drawScreen(mouseX, mouseY, partialTicks);
  91. }
  92.  
  93.  
  94. @Override
  95. protected void actionPerformed(GuiButton button) throws IOException {
  96. super.actionPerformed(button);
  97. //
  98. // if (button.id == 1) {
  99. //
  100. // CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(1));
  101. // RenderHelper.currentRender = RenderHelper.getRenderFromID(1);
  102. // }
  103. // if (button.id == 2) {
  104. // CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(2));
  105. // RenderHelper.currentRender = RenderHelper.getRenderFromID(2);
  106. //
  107. // }
  108. // if (button.id == 0) {
  109. //
  110. // CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(0));
  111. // RenderHelper.currentRender = RenderHelper.getRenderFromID(0);
  112. // }
  113.  
  114. if(button.id == 2){
  115.  
  116. if(type.getSliderPosition() == 0){
  117.  
  118. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(0));
  119. RenderHelper.currentRender = RenderHelper.getRenderFromID(0);
  120.  
  121. }
  122. if(type.getSliderPosition() == 1){
  123.  
  124. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(1));
  125. RenderHelper.currentRender = RenderHelper.getRenderFromID(1);
  126.  
  127. }
  128. if(type.getSliderPosition() == 2){
  129.  
  130. CreepzDisguises.INSTANCE.sendToServer(new CustomPacket(2));
  131. RenderHelper.currentRender = RenderHelper.getRenderFromID(2);
  132.  
  133. }
  134.  
  135.  
  136. }
  137.  
  138. }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement