Advertisement
Portl

Untitled

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