Skip to content

Commit

Permalink
Removed ability to pin Tabs. Moving functionality to HUDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonk9043 committed Jul 23, 2023
1 parent 5816571 commit 6af169f
Showing 1 changed file with 2 additions and 63 deletions.
65 changes: 2 additions & 63 deletions src/main/java/net/aoba/gui/tabs/ClickGuiTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
public class ClickGuiTab extends AbstractHud{
protected String title;

protected boolean pinnable = false;
protected boolean isPinned = false;
protected boolean pinWasClicked = false;
protected boolean drawBorder = true;
protected boolean inheritHeightFromChildren = true;

Expand All @@ -52,36 +49,12 @@ public ClickGuiTab(String title, int x, int y) {
this.width = 180;
this.mc = MinecraftClient.getInstance();
}

public ClickGuiTab(String title, int x, int y, boolean pinnable) {
super(x, y, 180, 0);
this.x = x;
this.y = y;
this.width = 180;
this.mc = MinecraftClient.getInstance();
this.pinnable = pinnable;
}


public final String getTitle() {
return title;
}

public final boolean isPinned() {
return this.isPinned;
}

public final void setPinned(boolean pin) {
this.isPinned = pin;
}

public final boolean getPinClicked() {
return this.pinWasClicked;
}

public final void setPinClicked(boolean pin) {
this.pinWasClicked = pin;
}

public final void setTitle(String title) {

this.title = title;
Expand Down Expand Up @@ -119,10 +92,6 @@ public final void setHeight(int height) {
this.height = height;
}

public final boolean getPinned() {
return this.isPinned;
}

public final boolean isGrabbed() {
return (HudManager.currentGrabbed == this);
}
Expand All @@ -146,27 +115,7 @@ public void update(double mouseX, double mouseY, boolean mouseClicked) {
if (mouseX >= (x) && mouseX <= (x + width)) {
if (mouseY >= (y) && mouseY <= (y + 28)) {
if (mouseClicked) {
boolean isInsidePinButton = false;
if(this.pinnable) {
if (mouseX >= (x + width - 24) && mouseX <= (x + width - 2)) {
if (mouseY >= (y + 4) && mouseY <= (y + 20)) {
isInsidePinButton = true;
}
}
}
if (isInsidePinButton) {
if (!this.pinWasClicked) {
this.isPinned = !this.isPinned;
this.pinWasClicked = true;
return;
}
} else {
HudManager.currentGrabbed = this;
}
} else {
if (this.pinWasClicked) {
this.pinWasClicked = false;
}
HudManager.currentGrabbed = this;
}
}
}
Expand Down Expand Up @@ -194,16 +143,6 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) {
renderUtils.drawRoundedOutline(matrixStack, x, y, width, height + 30, 6, new Color(0,0,0), 0.8f);
renderUtils.drawString(drawContext, this.title, x + 8, y + 8, Aoba.getInstance().hudManager.getColor());
renderUtils.drawLine(matrixStack, x, y + 30, x + width, y + 30, new Color(0,0,0), 0.4f);

if(this.pinnable) {
if (this.isPinned) {
renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(154,0,0), 0.8f);
renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.8f);
} else {
renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(128,128,128), 0.2f);
renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.2f);
}
}
}
int i = 30;
for (Component child : children) {
Expand Down

0 comments on commit 6af169f

Please sign in to comment.