Guest User

Untitled

a guest
Aug 12th, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. package Ignite.gui.clickgui.elements;
  2.  
  3. import Ignite.Ignite;
  4. import Ignite.modules.Module;
  5. import Ignite.utils.font.Fonts;
  6. import Ignite.utils.render.RenderUtils;
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.util.ResourceLocation;
  9.  
  10. import java.awt.*;
  11.  
  12. public class Button {
  13.  
  14. private int x;
  15. public int y;
  16. private int width;
  17. private int height;
  18. private String buttonText;
  19. private boolean hovered;
  20. private boolean visible;
  21. private boolean expandable;
  22. private boolean expanded;
  23.  
  24. public Button(int x, int y, int width, int height, String buttonText, boolean expandable) {
  25. this.x = x;
  26. this.y = y;
  27. this.width = width;
  28. this.height = height;
  29. this.buttonText = buttonText;
  30. this.visible = true;
  31. this.expandable = expandable;
  32. this.expanded = false;
  33. }
  34.  
  35. public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
  36. if (this.visible) {
  37. if(buttonText.equalsIgnoreCase("combat")) {
  38. RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/combat.png"));
  39. Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 62, this.y + 10, -1);
  40. } else if (buttonText.equalsIgnoreCase("visual")) {
  41. RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/visual.png"));
  42. Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 58, this.y + 9, -1);
  43. } else if (buttonText.equalsIgnoreCase("miscellaneous")) {
  44. RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/misc.png"));
  45. Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 80, this.y + 8, -1);
  46. } else {
  47. if(expandable && !expanded) {
  48. Module m = Ignite.getModuleByName(buttonText);
  49. RenderUtils.drawRoundedRectangle(this.x, this.y, this.x + width, this.y + height, 20, new Color(32, 32, 32, 255).getRGB());
  50. if (m.isToggled()) {
  51. Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, new Color(146, 32, 146, 255).getRGB());
  52. } else {
  53. Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, -1);
  54. }
  55. Fonts.apple18.drawString(m.description, this.x + 15, this.y + 24, new Color(146, 146, 146, 255).getRGB());
  56. } else {
  57. Module m = Ignite.getModuleByName(buttonText);
  58. RenderUtils.drawRoundedRectangle(this.x, this.y, this.x + width, this.y + (height * 3), 20, new Color(32, 32, 32, 255).getRGB());
  59. if (m.isToggled()) {
  60. Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, new Color(146, 32, 146, 255).getRGB());
  61. } else {
  62. Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, -1);
  63. }
  64. Fonts.apple18.drawString(m.description, this.x + 15, this.y + 24, new Color(146, 146, 146, 255).getRGB());
  65. }
  66. }
  67. }
  68. }
  69.  
  70. public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
  71. if (this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) {
  72. return true;
  73. }
  74. return false;
  75. }
  76.  
  77. public int getHeight() {
  78. return height;
  79. }
  80.  
  81. public String getButtonText() {
  82. return buttonText;
  83. }
  84.  
  85. public boolean isExpanded() {
  86. return expanded;
  87. }
  88.  
  89. public void setExpanded(boolean expanded) {
  90. this.expanded = expanded;
  91. }
  92.  
  93. public boolean isExpandable() {
  94. return expandable;
  95. }
  96. }
  97.  
Add Comment
Please, Sign In to add comment