Skip to content

Commit

Permalink
Patched Visibility inputs to child element classes.
Browse files Browse the repository at this point in the history
Version bump Beta-1.1.0
  • Loading branch information
ArcticRaven committed Oct 2, 2024
1 parent 1c85e22 commit bc396d4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class DisplayElementBuilder {
private Menu parentMenu;
private Division parentDivision;
private Vector offset;
private boolean visible;
private ItemStack displayItem;

public DisplayElementBuilder setParentMenu(Menu parentMenu) {
Expand All @@ -33,8 +34,13 @@ public DisplayElementBuilder setDisplayItem(ItemStack displayItem) {
return this;
}

public DisplayElementBuilder setVisibility(boolean visible) {
this.visible = visible;
return this;
}

public DisplayElement build() {

return new DisplayElement(parentMenu, parentDivision, offset, displayItem);
return new DisplayElement(parentMenu, parentDivision, offset, visible, displayItem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class OverlayElementBuilder {
private Menu parentMenu;
private Division parentDivision;
private Vector offset;
private boolean visible;
private boolean interactToRemove = false;
private long displayDuration = 0L;
private Component text;
Expand Down Expand Up @@ -46,7 +47,12 @@ public OverlayElementBuilder setText(Component text){
return this;
}

public OverlayElementBuilder setVisible(boolean visible) {
this.visible = visible;
return this;
}

public OverlayElement build() {
return new OverlayElement(parentMenu, parentDivision, offset, interactToRemove, displayDuration, text);
return new OverlayElement(parentMenu, parentDivision, offset, visible, interactToRemove, displayDuration, text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class TextElementBuilder {
private Menu parentMenu;
private Division parentDivision;
private Vector offset;
private boolean visible;
private Component text;

public TextElementBuilder setParentMenu(Menu parentMenu) {
Expand All @@ -34,8 +35,13 @@ public TextElementBuilder setText(Component text) {
return this;
}

public TextElementBuilder setVisible(boolean visible) {
this.visible = visible;
return this;
}

public TextElement build() {
TextElement textElement = new TextElement(parentMenu, parentDivision, offset);
TextElement textElement = new TextElement(parentMenu, parentDivision, offset, visible);
if (text != null) {
textElement.setText(text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ToggleElementBuilder {
private Menu parentMenu;
private Division parentDivision;
private Vector offset;
private boolean visible;
private AnimationType pressAnimationType = AnimationType.NONE;
private double pressAnimationStepper = 0.0;
private int duration;
Expand Down Expand Up @@ -58,7 +59,12 @@ public ToggleElementBuilder storeSecondaryText(Component secondaryText) {
return this;
}

public ToggleElementBuilder setVisibility(boolean visible) {
this.visible = visible;
return this;
}

public ToggleElement build() {
return new ToggleElement(parentMenu, parentDivision, offset, pressAnimationType, pressAnimationStepper, primaryText, secondaryText, duration);
return new ToggleElement(parentMenu, parentDivision, offset, visible, pressAnimationType, pressAnimationStepper, primaryText, secondaryText, duration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class DisplayElement extends Element implements IDisplayElement {
* @param offset The offset of this element from its parent division's location.
* @param displayItem The item stack to be displayed by this element.
*/
public DisplayElement(Menu parentMenu, Division parentDivision, Vector offset, ItemStack displayItem) {
super(parentMenu, parentDivision, offset);
public DisplayElement(Menu parentMenu, Division parentDivision, Vector offset, Boolean visible, ItemStack displayItem) {
super(parentMenu, parentDivision, offset, visible);
this.displayItem = displayItem;
initializeDisplayItem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class OverlayElement extends Element implements IOverlayElement {
private long displayDuration;
private Component text;

public OverlayElement(Menu parentMenu, Division parentDivision, Vector offset, boolean interactToRemove, long displayDuration, Component text) {
super(parentMenu, parentDivision, offset.add(new Vector(0, 0.1, 0)));
public OverlayElement(Menu parentMenu, Division parentDivision, Vector offset, boolean visible, boolean interactToRemove, long displayDuration, Component text) {
super(parentMenu, parentDivision, offset.add(new Vector(0, 0.1, 0)), visible);
this.interactToRemove = interactToRemove;
this.displayDuration = displayDuration;
this.text = text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public class TextElement extends Element implements ITextElement {

public TextElement(Menu parentMenu, Division parentDivision, Vector offset) {
super(parentMenu, parentDivision, offset);
public TextElement(Menu parentMenu, Division parentDivision, Vector offset, boolean visible) {
super(parentMenu, parentDivision, offset, visible);
this.interactionEntity.remove();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class ToggleElement extends Element implements IToggleElement {
private Component secondaryText;
private int duration;

public ToggleElement(Menu parentMenu, Division parentDivision, Vector offset, AnimationType pressAnimationType, double pressAnimationStepper, Component primaryText, Component secondaryText, int duration) {
super(parentMenu, parentDivision, offset);
public ToggleElement(Menu parentMenu, Division parentDivision, Vector offset, boolean visible, AnimationType pressAnimationType, double pressAnimationStepper, Component primaryText, Component secondaryText, int duration) {
super(parentMenu, parentDivision, offset, visible);
this.isPressed = false;
this.pressAnimationType = pressAnimationType;
this.pressAnimationStepper = pressAnimationStepper;
Expand Down

0 comments on commit bc396d4

Please sign in to comment.