Skip to content

Commit 8040c2b

Browse files
authored
Merge pull request #156 from pylonmc/pylon-invblock-qol
2 parents 7095f50 + 0d11aac commit 8040c2b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core/block/base

pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core/block/base/PylonGuiBlock.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ interface PylonGuiBlock : PylonBreakHandler, PylonInteractableBlock {
7272
}
7373
}
7474

75+
fun getItems() : List<ItemStack> {
76+
val items = mutableListOf<ItemStack>()
77+
val invs = inventories.get(this) ?: return listOf()
78+
for (inv in invs) {
79+
for (item in inv.items) {
80+
item?.let(items::add)
81+
}
82+
}
83+
return items
84+
}
85+
7586
companion object : Listener {
7687
private val inventoryKey = pylonKey("inventories")
7788
private val inventoryType =

0 commit comments

Comments
 (0)