Skip to content

Commit 7e85921

Browse files
Inventory operator extension for getting ObscuredInventory from IntRange
1 parent 10a07ba commit 7e85921

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/inventory/InventoryExtensions.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ operator fun Inventory.plusAssign(item: ItemStack) {
2424
/**
2525
* Checks if the [Inventory] contains an [ItemStack] similar to the given [item].
2626
*/
27-
operator fun Inventory.contains(item: ItemStack) = containsSimilar(item)
27+
operator fun Inventory.contains(item: ItemStack): Boolean =
28+
containsSimilar(item)
29+
30+
/**
31+
* Creates an [ObscuredInventory] of only the slots in the given [range].
32+
*/
33+
operator fun Inventory.get(range: IntRange): ObscuredInventory =
34+
ObscuredInventory(this) { it !in range }

0 commit comments

Comments
 (0)