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 8e73bb25..0acfd508 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 @@ -26,8 +26,10 @@ import io.github.cottonmc.cotton.gui.widget.focus.FocusModel; import io.github.cottonmc.cotton.gui.widget.icon.Icon; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnmodifiableView; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -409,6 +411,25 @@ protected ValidatedSlot createSlotPeer(Inventory inventory, int index, int x, in return new ValidatedSlot(inventory, index, x, y); } + /** + * {@return an unmodifiable list containing the current slot peers} + * + * @since 11.1.0 + */ + public @UnmodifiableView List getPeers() { + return Collections.unmodifiableList(peers); + } + + /** + * Gets the starting {@linkplain net.minecraft.screen.slot.Slot#id ID} for the slot peers. + * + * @return the starting ID for the slot peers, or -1 if this slot widget has no peers + * @since 11.1.0 + */ + public int getPeerStartId() { + return !peers.isEmpty() ? peers.getFirst().id : -1; + } + /** * Gets this slot widget's background painter. *