Class SlotRange
java.lang.Object
net.xun.lib.common.api.inventory.slot.SlotRange
Flexible slot range that can adapt to different container sizes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SlotRangeCombines multiple slot ranges into one.booleancontains(int slot, net.minecraft.world.Container container) Checks if a slot is within this range for a specific container.intgetEnd()getSlots(net.minecraft.world.Container container) Gets slots as an iterable sequence adjusted for container size.intgetStart()static SlotRangeof(int start, int end) Creates a fixed SlotRange from explicit values.static SlotRangesingle(int slot) Creates a single-slot range.stream(net.minecraft.world.Container container) Gets slots as a stream adjusted for container size.
-
Constructor Details
-
SlotRange
-
-
Method Details
-
getStart
public int getStart() -
getEnd
public int getEnd() -
of
Creates a fixed SlotRange from explicit values.- Parameters:
start- Starting slot (inclusive)end- Ending slot (exclusive)- Throws:
IllegalArgumentException- if start > end
-
single
Creates a single-slot range. -
contains
public boolean contains(int slot, net.minecraft.world.Container container) Checks if a slot is within this range for a specific container. -
stream
Gets slots as a stream adjusted for container size. -
combine
Combines multiple slot ranges into one. -
getSlots
Gets slots as an iterable sequence adjusted for container size.Essential for backward compatibility and iterator-based workflows.
- Parameters:
container- Target inventory container- Returns:
- Iterable slot sequence respecting container boundaries
-