From c8ab29d1d6111ba581b0f0bcb0a6d0c852161edb Mon Sep 17 00:00:00 2001 From: isxander Date: Wed, 22 Nov 2023 17:00:22 +0000 Subject: Update to 1.20.3-pre2, temp disable forge projects --- .../isxander/yacl3/gui/ElementListWidgetExt.java | 65 +++++----------------- .../dev/isxander/yacl3/gui/OptionListWidget.java | 4 +- .../isxander/yacl3/gui/TooltipButtonWidget.java | 8 ++- .../java/dev/isxander/yacl3/gui/YACLTooltip.java | 20 +++++++ 4 files changed, 40 insertions(+), 57 deletions(-) create mode 100644 common/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java (limited to 'common/src/main/java/dev/isxander/yacl3/gui') diff --git a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java index a36bd5e..91cda1f 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java @@ -14,17 +14,12 @@ import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; public class ElementListWidgetExt> extends ContainerObjectSelectionList implements LayoutElement { - protected int x, y; - private double smoothScrollAmount = getScrollAmount(); private boolean returnSmoothAmount = false; private final boolean doSmoothScrolling; public ElementListWidgetExt(Minecraft client, int x, int y, int width, int height, boolean smoothScrolling) { - super(client, width, height, y, y + height, 22); - this.x = this.x0 = x; - this.y = y; - this.x1 = this.x0 + width; + super(client, x, y, width, height); this.doSmoothScrolling = smoothScrolling; setRenderBackground(true); setRenderHeader(false, 0); @@ -40,17 +35,17 @@ public class ElementListWidgetExt> exten @Override protected int getScrollbarPosition() { // default implementation does not respect left/right - return this.x1 - 2; + return this.getX() + this.getWidth() - 2; } @Override - public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) { smoothScrollAmount = Mth.lerp(Minecraft.getInstance().getDeltaFrameTime() * 0.5, smoothScrollAmount, getScrollAmount()); returnSmoothAmount = true; - graphics.enableScissor(x0, y0, x1, y1); + graphics.enableScissor(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight()); - super.render(graphics, mouseX, mouseY, delta); + super.renderWidget(graphics, mouseX, mouseY, delta); graphics.disableScissor(); @@ -58,12 +53,10 @@ public class ElementListWidgetExt> exten } public void updateDimensions(ScreenRectangle rectangle) { - this.x0 = rectangle.left(); - this.y0 = rectangle.top(); - this.x1 = rectangle.right(); - this.y1 = rectangle.bottom(); - this.width = rectangle.width(); - this.height = rectangle.height(); + this.setX(rectangle.left()); + this.setY(rectangle.top()); + this.setWidth(rectangle.width()); + this.setHeight(rectangle.height()); } /** @@ -87,10 +80,10 @@ public class ElementListWidgetExt> exten protected E getEntryAtPosition(double x, double y) { y += getScrollAmount(); - if (x < this.x0 || x > this.x1) + if (x < this.getX() || x > this.getX() + this.getWidth()) return null; - int currentY = this.y0 - headerHeight + 4; + int currentY = this.getY() - headerHeight + 4; for (E entry : children()) { if (y >= currentY && y <= currentY + entry.getItemHeight()) { return entry; @@ -124,7 +117,7 @@ public class ElementListWidgetExt> exten @Override protected int getRowTop(int index) { - int integer = y0 + 4 - (int) this.getScrollAmount() + headerHeight; + int integer = getY() + 4 - (int) this.getScrollAmount() + headerHeight; for (int i = 0; i < children().size() && i < index; i++) integer += children().get(i).getItemHeight(); return integer; @@ -141,7 +134,7 @@ public class ElementListWidgetExt> exten int top = this.getRowTop(i); int bottom = top + entry.getItemHeight(); int entryHeight = entry.getItemHeight() - 4; - if (bottom >= this.y0 && top <= this.y1) { + if (bottom >= this.getY() && top <= this.getY() + this.getHeight()) { this.renderItem(graphics, mouseX, mouseY, delta, i, left, top, right, entryHeight); } } @@ -149,38 +142,6 @@ public class ElementListWidgetExt> exten /* END cloth config code */ - @Override - public void setX(int i) { - this.x = x0 = i; - this.x1 = x0 + width; - } - - @Override - public void setY(int i) { - this.y = y0 = i; - this.y1 = y0 + height; - } - - @Override - public int getX() { - return x; - } - - @Override - public int getY() { - return y; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public int getHeight() { - return height; - } - @Override public void visitWidgets(Consumer consumer) { } diff --git a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java index 666c3c8..e8b4eb6 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java @@ -31,7 +31,7 @@ public class OptionListWidget extends ElementListWidgetExt hoverEvent) { - super(client, x, y, width, height, true); + super(client, width, height, x, y, true); this.yaclScreen = screen; this.category = category; this.hoverEvent = hoverEvent; @@ -183,7 +183,7 @@ public class OptionListWidget extends ElementListWidgetExt Date: Tue, 5 Dec 2023 20:58:56 +0000 Subject: changelog for 1.20.3 --- build.gradle.kts | 2 +- changelogs/3.3.0-beta.1+1.20.3.md | 7 +++++++ .../src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java | 6 ------ gradle/libs.versions.toml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 changelogs/3.3.0-beta.1+1.20.3.md (limited to 'common/src/main/java/dev/isxander/yacl3/gui') diff --git a/build.gradle.kts b/build.gradle.kts index 10626a0..a614627 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ architectury { minecraft = libs.versions.minecraft.get() } -version = "3.3.0+1.20.3" +version = "3.3.0-beta.1+1.20.3" val isBeta = "beta" in version.toString() val changelogText = rootProject.file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided." diff --git a/changelogs/3.3.0-beta.1+1.20.3.md b/changelogs/3.3.0-beta.1+1.20.3.md new file mode 100644 index 0000000..d958c46 --- /dev/null +++ b/changelogs/3.3.0-beta.1+1.20.3.md @@ -0,0 +1,7 @@ +# YetAnotherConfigLib v3.3.0-beta.1 for 1.20.3 + +Updates to support 1.20.3. + +## Known Issues + +- Tooltips flicker when hovering over save button. diff --git a/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java index 143512f..f439301 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/TooltipButtonWidget.java @@ -18,10 +18,4 @@ public class TooltipButtonWidget extends Button { if (tooltip != null) setTooltip(new YACLTooltip(tooltip, this)); } - - @Nullable - @Override - public Tooltip getTooltip() { - return super.getTooltip(); - } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 19f5382..917f871 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ github_release = "2.4.+" machete = "2.+" grgit = "5.0.+" -minecraft = "1.20.3-pre2" +minecraft = "1.20.3" quilt_mappings = "0" fabric_loader = "0.14.23" -- cgit