Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. package met.greycode.gui;
  2.  
  3. import java.awt.Color;
  4.  
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.client.gui.FontRenderer;
  7. import net.minecraft.client.gui.Gui;
  8. import net.minecraft.client.gui.GuiButton;
  9.  
  10. public class UIButton extends GuiButton{
  11.  
  12. private static int buttonId;
  13. private int fade;
  14.  
  15. public UIButton (final int buttonId, final int x, final int y, final String buttonText) {
  16. this(buttonId, x, y, 200, 20, buttonText);
  17. }
  18.  
  19. public UIButton (final int buttonID, final int x, final int y, final int widhtIn, final int heightIn, final String buttonText) {
  20. super (buttonId, x, y, widhtIn, heightIn, buttonText);
  21. }
  22.  
  23. @Override
  24. public void drawButton(Minecraft mc, int mouseX, int mouseY) {
  25. if (this.visible) {
  26. this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height) ;
  27. if (!hovered) {
  28. if (this.fade != 100) {
  29. this.fade += 5;
  30. }
  31. }
  32. else
  33. if (this.fade <= 40) {
  34. return;
  35. }
  36. if (this.fade != 70) {
  37. this.fade -= 5;
  38. }
  39. }
  40. final Color a = new Color (255, 255, 255, this.fade);
  41. final FontRenderer var4 = mc.fontRendererObj;
  42. Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, a.getRGB());
  43. this.drawCenteredString(var4, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0x48f442);
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement