Skip to content

Commit

Permalink
Remove deprecated APIs
Browse files Browse the repository at this point in the history
- ValidatedSlot.getFilter
- ValidatedSlot.setFilter
- WItemSlot.getFilter
- WItemSlot.setFilter
- WListPanel.margin
  • Loading branch information
Juuxel committed Jun 24, 2024
1 parent 15ed18f commit 951c759
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 61 deletions.
24 changes: 0 additions & 24 deletions src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,6 @@ public void setOutputFilter(Predicate<ItemStack> 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<ItemStack> 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<ItemStack> filter) {
setInputFilter(filter);
}

/**
* Adds a change listener to this slot.
* Does nothing if the listener is already registered.
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,31 +481,6 @@ public WItemSlot setOutputFilter(Predicate<ItemStack> 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<ItemStack> 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<ItemStack> filter) {
return setInputFilter(filter);
}

@Environment(EnvType.CLIENT)
@Override
public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) {
Expand Down
16 changes: 4 additions & 12 deletions src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,15 +54,8 @@ public class WListPanel<D, W extends WWidget> 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.
Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -275,7 +267,7 @@ public WListPanel<D, W> setInsets(Insets insets) {
*/
public int getGap() {
// Returns the *effective* gap of this list for backwards compat.
return gap >= 0 ? gap : margin;
return gap;
}

/**
Expand Down

0 comments on commit 951c759

Please sign in to comment.