Skip to content

Commit 9ee4e53

Browse files
committed
better main hand container transfer
1 parent 1e1c7e7 commit 9ee4e53

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/main/kotlin/com/lambda/interaction/material/container/containers/MainHandContainer.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ object MainHandContainer : MaterialContainer(Rank.MainHand) {
6464
return@inventoryRequest
6565
}
6666

67-
val slots = player.currentScreenHandler.slots.filter { it.stack == moveStack }
68-
69-
if (slots.isNotEmpty()) swap(player.currentScreenHandler.slots.indexOf(slots.first()), player.inventory.selectedSlot)
70-
else throw NotInInventoryException()
67+
val slot = player.currentScreenHandler.slots.first { it.stack == moveStack } ?: throw NotInInventoryException()
68+
swap(slot.id, player.inventory.selectedSlot)
7169

7270
if (hand == Hand.OFF_HAND) swapHands()
7371

src/main/kotlin/com/lambda/interaction/material/transfer/SlotTransfer.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class SlotTransfer @Ta5kBuilder constructor(
7171
val nextTo = selectedTo.firstOrNull() ?: return@listen
7272

7373
inventoryRequest {
74-
// moveSlot(nextFrom.id, nextTo.id)
7574
swap(nextTo.id, 1)
7675
swap(nextFrom.id, 1)
7776
onComplete { success() }

0 commit comments

Comments
 (0)