Skip to content

Commit 1e1c7e7

Browse files
committed
fuck it idc
1 parent 705e8d9 commit 1e1c7e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import com.lambda.interaction.material.StackSelection
2525
import com.lambda.interaction.material.container.MaterialContainer
2626
import com.lambda.interaction.request.inventory.InventoryRequest.Companion.inventoryRequest
2727
import com.lambda.util.item.ItemStackUtils.equal
28-
import com.lambda.util.player.SlotUtils.combined
29-
import com.lambda.util.player.SlotUtils.storage
3028
import com.lambda.util.text.buildText
3129
import com.lambda.util.text.literal
3230
import net.minecraft.item.ItemStack
@@ -66,9 +64,13 @@ object MainHandContainer : MaterialContainer(Rank.MainHand) {
6664
return@inventoryRequest
6765
}
6866

69-
if (moveStack in player.storage) swap(player.combined.indexOf(moveStack), 0)
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)
7070
else throw NotInInventoryException()
7171

72+
if (hand == Hand.OFF_HAND) swapHands()
73+
7274
onComplete { success() }
7375
}.submit(queueIfClosed = false)
7476
}

0 commit comments

Comments
 (0)