Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More API improvements. #491

Open
wants to merge 1 commit into
base: 1.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main/java/mcjty/theoneprobe/api/IProbeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ public interface IProbeInfo {
* Create a default style for the icon element
*/
IIconStyle defaultIconStyle();

/**
* Creates a Vertical Panel without adding it to elements.
*/
IProbeInfo createVerticalPanel();
IProbeInfo createVerticalPanel(ILayoutStyle style);

/**
* Creates a Horizontal Panel without adding it to elements.
*/
IProbeInfo createHorizontalPanel();
IProbeInfo createHorizontalPanel(ILayoutStyle style);

/**
* Converts the ProbeInfo into the element. Reduces casting.
*/
IElement asElement();


/**
* Create an icon. If u and v are -1 then the default texture atlas is used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,29 @@ public IEntityStyle defaultEntityStyle() {
public IIconStyle defaultIconStyle() {
return new IconStyle();
}
}

@Override
public IProbeInfo createVerticalPanel() {
return new ElementVertical(new LayoutStyle().spacing(ElementVertical.SPACING).alignment(ElementAlignment.ALIGN_TOPLEFT));
}

@Override
public IProbeInfo createVerticalPanel(ILayoutStyle style) {
return new ElementVertical(style);
}

@Override
public IProbeInfo createHorizontalPanel() {
return new ElementHorizontal(new LayoutStyle().spacing(layout.getSpacing()).alignment(ElementAlignment.ALIGN_TOPLEFT));
}

@Override
public IProbeInfo createHorizontalPanel(ILayoutStyle style) {
return new ElementHorizontal(style);
}

@Override
public IElement asElement() {
return this;
}
}