diff options
Diffstat (limited to 'src/client/java/dev/isxander/yacl/gui')
34 files changed, 550 insertions, 548 deletions
diff --git a/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java b/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java index 529748d..c6d2b09 100644 --- a/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/AbstractWidget.java @@ -1,25 +1,24 @@ package dev.isxander.yacl.gui; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import dev.isxander.yacl.api.utils.Dimension; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; -import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.sound.SoundEvents; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.sounds.SoundEvents; import java.awt.Color; -public abstract class AbstractWidget implements Element, Drawable, Selectable { - protected final MinecraftClient client = MinecraftClient.getInstance(); - protected final TextRenderer textRenderer = client.textRenderer; +public abstract class AbstractWidget implements GuiEventListener, Renderable, NarratableEntry { + protected final Minecraft client = Minecraft.getInstance(); + protected final Font textRenderer = client.font; protected final int inactiveColor = 0xFFA0A0A0; private Dimension<Integer> dim; @@ -28,7 +27,7 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable { this.dim = dim; } - public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void postRender(PoseStack matrices, int mouseX, int mouseY, float delta) { } @@ -51,8 +50,8 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable { } @Override - public SelectionType getType() { - return SelectionType.NONE; + public NarrationPriority narrationPriority() { + return NarrationPriority.NONE; } public void unfocus() { @@ -64,11 +63,11 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable { } @Override - public void appendNarrations(NarrationMessageBuilder builder) { + public void updateNarration(NarrationElementOutput builder) { } - protected void drawButtonRect(MatrixStack matrices, int x1, int y1, int x2, int y2, boolean hovered, boolean enabled) { + protected void drawButtonRect(PoseStack matrices, int x1, int y1, int x2, int y2, boolean hovered, boolean enabled) { if (x1 > x2) { int xx1 = x1; x1 = x2; @@ -82,15 +81,15 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable { int width = x2 - x1; int height = y2 - y1; - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - RenderSystem.setShaderTexture(0, ClickableWidget.WIDGETS_TEXTURE); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShaderTexture(0, net.minecraft.client.gui.components.AbstractWidget.WIDGETS_LOCATION); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); int i = !enabled ? 0 : hovered ? 2 : 1; RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableDepthTest(); - DrawableHelper.drawTexture(matrices, x1, y1, 0, 0, 46 + i * 20, width / 2, height, 256, 256); - DrawableHelper.drawTexture(matrices, x1 + width / 2, y1, 0, 200 - width / 2f, 46 + i * 20, width / 2, height, 256, 256); + GuiComponent.blit(matrices, x1, y1, 0, 0, 46 + i * 20, width / 2, height, 256, 256); + GuiComponent.blit(matrices, x1 + width / 2, y1, 0, 200 - width / 2f, 46 + i * 20, width / 2, height, 256, 256); } protected int multiplyColor(int hex, float amount) { @@ -103,6 +102,6 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable { } public void playDownSound() { - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } } diff --git a/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java b/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java index 71a8e4e..41286ff 100644 --- a/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/CategoryListWidget.java @@ -2,23 +2,23 @@ package dev.isxander.yacl.gui; import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; import dev.isxander.yacl.api.ConfigCategory; import dev.isxander.yacl.gui.utils.GuiUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; import java.util.List; public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget.CategoryEntry> { private final YACLScreen yaclScreen; - public CategoryListWidget(MinecraftClient client, YACLScreen yaclScreen, int screenWidth, int screenHeight) { + public CategoryListWidget(Minecraft client, YACLScreen yaclScreen, int screenWidth, int screenHeight) { super(client, 0, 0, screenWidth / 3, yaclScreen.searchFieldWidget.getY() - 5, true); this.yaclScreen = yaclScreen; setRenderBackground(false); - setRenderHorizontalShadows(false); + setRenderTopAndBottom(false); for (ConfigCategory category : yaclScreen.config.categories()) { addEntry(new CategoryEntry(category)); @@ -26,7 +26,7 @@ public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget. } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { GuiUtils.enableScissor(0, 0, width, height); super.render(matrices, mouseX, mouseY, delta); RenderSystem.disableScissor(); @@ -43,12 +43,12 @@ public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget. } @Override - protected int getScrollbarPositionX() { + protected int getScrollbarPosition() { return width - 2; } @Override - protected void renderBackground(MatrixStack matrices) { + protected void renderBackground(PoseStack matrices) { } @@ -68,8 +68,8 @@ public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget. } @Override - public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - if (mouseY > bottom) { + public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + if (mouseY > y1) { mouseY = -20; } @@ -77,7 +77,7 @@ public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget. categoryButton.render(matrices, mouseX, mouseY, tickDelta); } - public void postRender(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) { + public void postRender(PoseStack matrices, int mouseX, int mouseY, float tickDelta) { categoryButton.renderHoveredTooltip(matrices); } @@ -87,12 +87,12 @@ public class CategoryListWidget extends ElementListWidgetExt<CategoryListWidget. } @Override - public List<? extends Element> children() { + public List<? extends GuiEventListener> children() { return ImmutableList.of(categoryButton); } @Override - public List<? extends Selectable> selectableChildren() { + public List<? extends NarratableEntry> narratables() { return ImmutableList.of(categoryButton); } } diff --git a/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java b/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java index 3c5d8d2..f47a09b 100644 --- a/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/CategoryWidget.java @@ -1,14 +1,14 @@ package dev.isxander.yacl.gui; import dev.isxander.yacl.api.ConfigCategory; -import net.minecraft.client.sound.SoundManager; +import net.minecraft.client.sounds.SoundManager; public class CategoryWidget extends TooltipButtonWidget { private final int categoryIndex; public CategoryWidget(YACLScreen screen, ConfigCategory category, int categoryIndex, int x, int y, int width, int height) { super(screen, x, y, width, height, category.name(), category.tooltip(), btn -> { - screen.searchFieldWidget.setText(""); + screen.searchFieldWidget.setValue(""); screen.changeCategory(categoryIndex); }); this.categoryIndex = categoryIndex; diff --git a/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java b/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java index 708c6bf..e28509e 100644 --- a/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java +++ b/src/client/java/dev/isxander/yacl/gui/ElementListWidgetExt.java @@ -1,24 +1,23 @@ package dev.isxander.yacl.gui; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.widget.ElementListWidget; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.MathHelper; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.ContainerObjectSelectionList; +import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; -public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> extends ElementListWidget<E> { +public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> extends ContainerObjectSelectionList<E> { protected final int x, y; private double smoothScrollAmount = getScrollAmount(); private boolean returnSmoothAmount = false; private final boolean doSmoothScrolling; - public ElementListWidgetExt(MinecraftClient client, int x, int y, int width, int height, boolean smoothScrolling) { + public ElementListWidgetExt(Minecraft client, int x, int y, int width, int height, boolean smoothScrolling) { super(client, width, height, y, y + height, 22); - this.x = x; + this.x = this.x0 = x; this.y = y; - this.left = x; - this.right = this.left + width; + this.x1 = this.x0 + width; this.doSmoothScrolling = smoothScrolling; } @@ -30,22 +29,22 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten } @Override - protected void renderBackground(MatrixStack matrices) { + protected void renderBackground(PoseStack matrices) { // render transparent background if in-game. - setRenderBackground(client.world == null); - if (client.world != null) - fill(matrices, left, top, right, bottom, 0x6B000000); + setRenderBackground(minecraft.level == null); + if (minecraft.level != null) + fill(matrices, x0, y0, x1, y1, 0x6B000000); } @Override - protected int getScrollbarPositionX() { + protected int getScrollbarPosition() { // default implementation does not respect left/right - return this.right - 2; + return this.x1 - 2; } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { - smoothScrollAmount = MathHelper.lerp(MinecraftClient.getInstance().getLastFrameDuration() * 0.5, smoothScrollAmount, getScrollAmount()); + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + smoothScrollAmount = Mth.lerp(Minecraft.getInstance().getDeltaFrameTime() * 0.5, smoothScrollAmount, getScrollAmount()); returnSmoothAmount = true; super.render(matrices, mouseX, mouseY, delta); returnSmoothAmount = false; @@ -67,7 +66,7 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten this.smoothScrollAmount = getScrollAmount(); } - public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void postRender(PoseStack matrices, int mouseX, int mouseY, float delta) { for (E entry : children()) { entry.postRender(matrices, mouseX, mouseY, delta); } @@ -78,10 +77,10 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten protected E getEntryAtPosition(double x, double y) { y += getScrollAmount(); - if (x < this.left || x > this.right) + if (x < this.x0 || x > this.x1) return null; - int currentY = this.top - headerHeight + 4; + int currentY = this.y0 - headerHeight + 4; for (E entry : children()) { if (y >= currentY && y <= currentY + entry.getItemHeight()) { return entry; @@ -107,41 +106,41 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten @Override protected void centerScrollOn(E entry) { - double d = (this.bottom - this.top) / -2d; - for (int i = 0; i < this.children().indexOf(entry) && i < this.getEntryCount(); i++) + double d = (this.height) / -2d; + for (int i = 0; i < this.children().indexOf(entry) && i < this.getItemCount(); i++) d += children().get(i).getItemHeight(); this.setScrollAmount(d); } @Override protected int getRowTop(int index) { - int integer = top + 4 - (int) this.getScrollAmount() + headerHeight; + int integer = y0 + 4 - (int) this.getScrollAmount() + headerHeight; for (int i = 0; i < children().size() && i < index; i++) integer += children().get(i).getItemHeight(); return integer; } @Override - protected void renderList(MatrixStack matrices, int mouseX, int mouseY, float delta) { + protected void renderList(PoseStack matrices, int mouseX, int mouseY, float delta) { int left = this.getRowLeft(); int right = this.getRowWidth(); - int count = this.getEntryCount(); + int count = this.getItemCount(); for(int i = 0; i < count; ++i) { E entry = children().get(i); int top = this.getRowTop(i); int bottom = top + entry.getItemHeight(); int entryHeight = entry.getItemHeight() - 4; - if (bottom >= this.top && top <= this.bottom) { - this.renderEntry(matrices, mouseX, mouseY, delta, i, left, top, right, entryHeight); + if (bottom >= this.y0 && top <= this.y1) { + this.renderItem(matrices, mouseX, mouseY, delta, i, left, top, right, entryHeight); } } } /* END cloth config code */ - public abstract static class Entry<E extends ElementListWidgetExt.Entry<E>> extends ElementListWidget.Entry<E> { - public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public abstract static class Entry<E extends ElementListWidgetExt.Entry<E>> extends ContainerObjectSelectionList.Entry<E> { + public void postRender(PoseStack matrices, int mouseX, int mouseY, float delta) { } diff --git a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java index 36e0852..3b66b6a 100644 --- a/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java @@ -1,27 +1,27 @@ package dev.isxander.yacl.gui; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.tooltip.Tooltip; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; -import net.minecraft.util.math.MathHelper; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Tooltip; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; -public class LowProfileButtonWidget extends ButtonWidget { - public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress) { - super(x, y, width, height, message, onPress, DEFAULT_NARRATION_SUPPLIER); +public class LowProfileButtonWidget extends Button { + public LowProfileButtonWidget(int x, int y, int width, int height, Component message, OnPress onPress) { + super(x, y, width, height, message, onPress, DEFAULT_NARRATION); } - public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, Tooltip tooltip) { + public LowProfileButtonWidget(int x, int y, int width, int height, Component message, OnPress onPress, Tooltip tooltip) { this(x, y, width, height, message, onPress); setTooltip(tooltip); } @Override - public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { - if (!isHovered() || !active) { + public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) { + if (!isHoveredOrFocused() || !active) { int j = this.active ? 0xFFFFFF : 0xA0A0A0; - drawCenteredText(matrices, MinecraftClient.getInstance().textRenderer, this.getMessage(), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); + drawCenteredString(matrices, Minecraft.getInstance().font, this.getMessage(), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j | Mth.ceil(this.alpha * 255.0F) << 24); } else { super.renderButton(matrices, mouseX, mouseY, delta); } diff --git a/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java index efeab14..097f076 100644 --- a/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java +++ b/src/client/java/dev/isxander/yacl/gui/OptionListWidget.java @@ -1,20 +1,20 @@ package dev.isxander.yacl.gui; import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.vertex.PoseStack; import dev.isxander.yacl.api.*; import dev.isxander.yacl.api.utils.Dimension; import dev.isxander.yacl.impl.utils.YACLConstants; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.MultilineText; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; -import net.minecraft.client.gui.screen.narration.NarrationPart; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.components.MultiLineLabel; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.narration.NarratedElementType; +import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -23,9 +23,9 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr private final YACLScreen yaclScreen; private boolean singleCategory = false; - private ImmutableList<Entry> viewableChildren; + private ImmutableList<dev.isxander.yacl.gui.OptionListWidget.Entry> viewableChildren; - public OptionListWidget(YACLScreen screen, MinecraftClient client, int width, int height) { + public OptionListWidget(YACLScreen screen, Minecraft client, int width, int height) { super(client, width / 3, 0, width / 3 * 2 + 1, height, true); this.yaclScreen = screen; @@ -64,7 +64,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr groupSeparatorEntry = null; } - List<Entry> optionEntries = new ArrayList<>(); + List<dev.isxander.yacl.gui.OptionListWidget.Entry> optionEntries = new ArrayList<>(); // add empty entry to make sure users know it's empty not just bugging out if (groupSeparatorEntry instanceof ListGroupSeparatorEntry listGroupSeparatorEntry) { @@ -101,7 +101,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr return; } - for (Entry entry : groupSeparator.childEntries) + for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : groupSeparator.childEntries) super.removeEntry(entry); groupSeparator.childEntries.clear(); @@ -113,7 +113,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr return; } - Entry lastEntry = groupSeparator; + dev.isxander.yacl.gui.OptionListWidget.Entry lastEntry = groupSeparator; for (ListOptionEntry<?> listOptionEntry : listOption.options()) { OptionEntry optionEntry = new OptionEntry(listOptionEntry, category, listOption, groupSeparator, listOptionEntry.controller().provideWidget(yaclScreen, getDefaultEntryDimension())); addEntryBelow(lastEntry, optionEntry); @@ -127,7 +127,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } public void expandAllGroups() { - for (Entry entry : super.children()) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : super.children()) { if (entry instanceof GroupSeparatorEntry groupSeparatorEntry) { groupSeparatorEntry.setExpanded(true); } @@ -141,7 +141,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - for (Entry child : children()) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { if (child != getEntryAtPosition(mouseX, mouseY) && child instanceof OptionEntry optionEntry) optionEntry.widget.unfocus(); } @@ -153,7 +153,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr public boolean mouseScrolled(double mouseX, double mouseY, double amount) { super.mouseScrolled(mouseX, mouseY, amount); - for (Entry child : children()) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { if (child.mouseScrolled(mouseX, mouseY, amount)) break; } @@ -163,7 +163,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - for (Entry child : children()) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { if (child.keyPressed(keyCode, scanCode, modifiers)) return true; } @@ -173,7 +173,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr @Override public boolean charTyped(char chr, int modifiers) { - for (Entry child : children()) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry child : children()) { if (child.charTyped(chr, modifiers)) return true; } @@ -182,16 +182,16 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } @Override - protected int getScrollbarPositionX() { - return right - (int)(width * 0.05f); + protected int getScrollbarPosition() { + return x1 - (int)(width * 0.05f); } public void recacheViewableChildren() { - this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(Entry::isViewable).toList()); + this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(dev.isxander.yacl.gui.OptionListWidget.Entry::isViewable).toList()); // update y positions before they need to be rendered are rendered int i = 0; - for (Entry entry : viewableChildren) { + for (dev.isxander.yacl.gui.OptionListWidget.Entry entry : viewableChildren) { if (entry instanceof OptionEntry optionEntry) optionEntry.widget.setDimension(optionEntry.widget.getDimension().withY(getRowTop(i))); i++; @@ -224,8 +224,8 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } @Override - public boolean removeEntryWithoutScrolling(Entry entry) { - boolean ret = super.removeEntryWithoutScrolling(entry); + public boolean removeEntryFromTop(Entry entry) { + boolean ret = super.removeEntryFromTop(entry); recacheViewableChildren(); return ret; } @@ -243,7 +243,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr } protected boolean isHovered() { - return Objects.equals(getHoveredEntry(), this); + return Objects.equals(getHovered(), this); } } @@ -271,7 +271,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr this.groupName = group.name().getString().toLowerCase(); if (option.canResetToD |
