From 951c759d27f73b178437fc5143ac42b612cd7907 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:18:07 +0300 Subject: [PATCH] Remove deprecated APIs - ValidatedSlot.getFilter - ValidatedSlot.setFilter - WItemSlot.getFilter - WItemSlot.setFilter - WListPanel.margin --- .../cottonmc/cotton/gui/ValidatedSlot.java | 24 ------------------ .../cottonmc/cotton/gui/widget/WItemSlot.java | 25 ------------------- .../cotton/gui/widget/WListPanel.java | 16 +++--------- 3 files changed, 4 insertions(+), 61 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java index 0c692553..27b221b4 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java @@ -156,30 +156,6 @@ public void setOutputFilter(Predicate outputFilter) { this.outputFilter = outputFilter; } - /** - * Gets the item stack filter of this slot. - * - * @return the item filter - * @deprecated Replaced by {@link #getInputFilter()} - * @since 2.0.0 - */ - @Deprecated(forRemoval = true) - public Predicate getFilter() { - return inputFilter; - } - - /** - * Sets the item stack filter of this slot. - * - * @param filter the new item filter - * @deprecated Replaced by {@link #setInputFilter(Predicate)} - * @since 2.0.0 - */ - @Deprecated(forRemoval = true) - public void setFilter(Predicate filter) { - setInputFilter(filter); - } - /** * Adds a change listener to this slot. * Does nothing if the listener is already registered. diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java index 0618ed67..8e73bb25 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java @@ -481,31 +481,6 @@ public WItemSlot setOutputFilter(Predicate outputFilter) { return this; } - /** - * Gets the item filter of this item slot. - * - * @return the item filter - * @deprecated Replaced by {@link #getInputFilter()} - * @since 2.0.0 - */ - @Deprecated(forRemoval = true) - public Predicate getFilter() { - return inputFilter; - } - - /** - * Sets the item filter of this item slot. - * - * @param filter the new item filter - * @return this item slot - * @deprecated Replaced by {@link #setInputFilter(Predicate)} - * @since 2.0.0 - */ - @Deprecated(forRemoval = true) - public WItemSlot setFilter(Predicate filter) { - return setInputFilter(filter); - } - @Environment(EnvType.CLIENT) @Override public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java index 6af0f1e0..8406b5c6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java @@ -9,7 +9,6 @@ import io.github.cottonmc.cotton.gui.widget.data.Axis; import io.github.cottonmc.cotton.gui.widget.data.InputResult; import io.github.cottonmc.cotton.gui.widget.data.Insets; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.HashMap; @@ -55,15 +54,8 @@ public class WListPanel extends WClippedPanel { */ protected boolean fixedHeight = false; - /** - * @deprecated Replaced with {@link #getInsets() insets} and {@link #getGap() gap}. - */ - @Deprecated(forRemoval = true) - protected int margin = 4; - - // When the margin field is removed, these should get default values Insets(4, 4) and 4. - private @Nullable Insets insets = null; - private int gap = -1; + private Insets insets = new Insets(4, 4); + private int gap = 4; /** * The scroll bar of this list. @@ -254,7 +246,7 @@ public WScrollBar getScrollBar() { */ public Insets getInsets() { // Returns the *effective* insets of this list for backwards compat. - return insets != null ? insets : new Insets(margin, margin); + return insets; } /** @@ -275,7 +267,7 @@ public WListPanel setInsets(Insets insets) { */ public int getGap() { // Returns the *effective* gap of this list for backwards compat. - return gap >= 0 ? gap : margin; + return gap; } /**