mirror of
https://github.com/naalit/slotlink.git
synced 2025-12-31 04:13:02 +00:00
devrun: add ability to fill inventories with same item
This commit is contained in:
parent
fcab1a0058
commit
0042776294
1 changed files with 4 additions and 1 deletions
|
|
@ -32,7 +32,10 @@ object StorageFillerItem : Item(ModItem.SETTINGS) {
|
|||
val storage = ItemStorage.SIDED.find(world, pos, Direction.UP)
|
||||
if (storage != null) Transaction.openOuter().use { transaction ->
|
||||
while (true) {
|
||||
val item = Registries.ITEM.getRandom(world.random).get().value()
|
||||
val item =
|
||||
if (!player.offHandStack.isEmpty) player.offHandStack.item
|
||||
else Registries.ITEM.getRandom(world.random).get().value()
|
||||
|
||||
if (storage.insert(ItemVariant.of(item), item.maxCount.toLong(), transaction) == 0L) break
|
||||
}
|
||||
transaction.commit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue