feat(resource-pack-entry-widgets): do not provide default width/height
This commit is contained in:
parent
35295051c8
commit
a7836ef624
@ -39,9 +39,7 @@ public interface ResourcePackEntryWidget {
|
||||
* @param pack the pack to render the widget for
|
||||
* @return the width of the widget
|
||||
*/
|
||||
default int getWidth(ResourcePackOrganizer.Pack pack) {
|
||||
return 20;
|
||||
}
|
||||
int getWidth(ResourcePackOrganizer.Pack pack);
|
||||
|
||||
/**
|
||||
* Gets the height of this widget.
|
||||
@ -50,9 +48,7 @@ public interface ResourcePackEntryWidget {
|
||||
* @param rowHeight the height of the row containing the widget
|
||||
* @return the height of the widget
|
||||
*/
|
||||
default int getHeight(ResourcePackOrganizer.Pack pack, int rowHeight) {
|
||||
return 20;
|
||||
}
|
||||
int getHeight(ResourcePackOrganizer.Pack pack, int rowHeight);
|
||||
|
||||
/**
|
||||
* Gets the Y position of this widget relative to the top of the row.
|
||||
|
@ -10,6 +10,16 @@ public class TestWidget1 implements ResourcePackEntryWidget {
|
||||
return (int) ((System.currentTimeMillis() % 5_000) / 100 + 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(ResourcePackOrganizer.Pack pack, int rowHeight) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY(ResourcePackOrganizer.Pack pack, int rowHeight) {
|
||||
return 14;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXMargin(ResourcePackOrganizer.Pack pack) {
|
||||
return (int) (Math.abs((System.currentTimeMillis() % 1_200) / 50 - 12) + 5);
|
||||
|
@ -10,6 +10,16 @@ public class TestWidget2 implements ResourcePackEntryWidget {
|
||||
return System.currentTimeMillis() % 1_000 < 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth(ResourcePackOrganizer.Pack pack) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight(ResourcePackOrganizer.Pack pack, int rowHeight) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(ResourcePackOrganizer.Pack pack, DrawContext context, int x, int y, boolean hovered, float tickDelta) {
|
||||
context.fill(x, y, x + getWidth(pack), y + getHeight(pack, 20), hovered ? 0x80FF0080 : 0x80FF0000);
|
||||
|
Loading…
Reference in New Issue
Block a user