Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ignite.gui.clickgui.elements;
- import Ignite.Ignite;
- import Ignite.modules.Module;
- import Ignite.utils.font.Fonts;
- import Ignite.utils.render.RenderUtils;
- import net.minecraft.client.Minecraft;
- import net.minecraft.util.ResourceLocation;
- import java.awt.*;
- public class Button {
- private int x;
- public int y;
- private int width;
- private int height;
- private String buttonText;
- private boolean hovered;
- private boolean visible;
- private boolean expandable;
- private boolean expanded;
- public Button(int x, int y, int width, int height, String buttonText, boolean expandable) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- this.buttonText = buttonText;
- this.visible = true;
- this.expandable = expandable;
- this.expanded = false;
- }
- public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
- if (this.visible) {
- if(buttonText.equalsIgnoreCase("combat")) {
- RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/combat.png"));
- Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 62, this.y + 10, -1);
- } else if (buttonText.equalsIgnoreCase("visual")) {
- RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/visual.png"));
- Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 58, this.y + 9, -1);
- } else if (buttonText.equalsIgnoreCase("miscellaneous")) {
- RenderUtils.drawCustomImage(this.x, this.y, 25, 25, new ResourceLocation("/textures/gui/title/misc.png"));
- Fonts.SFReg24.drawCenteredString(this.buttonText, this.x + 80, this.y + 8, -1);
- } else {
- if(expandable && !expanded) {
- Module m = Ignite.getModuleByName(buttonText);
- RenderUtils.drawRoundedRectangle(this.x, this.y, this.x + width, this.y + height, 20, new Color(32, 32, 32, 255).getRGB());
- if (m.isToggled()) {
- Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, new Color(146, 32, 146, 255).getRGB());
- } else {
- Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, -1);
- }
- Fonts.apple18.drawString(m.description, this.x + 15, this.y + 24, new Color(146, 146, 146, 255).getRGB());
- } else {
- Module m = Ignite.getModuleByName(buttonText);
- RenderUtils.drawRoundedRectangle(this.x, this.y, this.x + width, this.y + (height * 3), 20, new Color(32, 32, 32, 255).getRGB());
- if (m.isToggled()) {
- Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, new Color(146, 32, 146, 255).getRGB());
- } else {
- Fonts.apple24.drawString(this.buttonText, this.x + 15, this.y + 9, -1);
- }
- Fonts.apple18.drawString(m.description, this.x + 15, this.y + 24, new Color(146, 146, 146, 255).getRGB());
- }
- }
- }
- }
- public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
- if (this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) {
- return true;
- }
- return false;
- }
- public int getHeight() {
- return height;
- }
- public String getButtonText() {
- return buttonText;
- }
- public boolean isExpanded() {
- return expanded;
- }
- public void setExpanded(boolean expanded) {
- this.expanded = expanded;
- }
- public boolean isExpandable() {
- return expandable;
- }
- }
Add Comment
Please, Sign In to add comment