interactions: don't interact with offhand if unavailable (<1.9)

This commit is contained in:
Bixilon 2023-03-21 21:37:59 +01:00
parent 56b495a514
commit bc0dc833f4
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -89,6 +89,10 @@ class UseHandler(
// check both hands if we can interact
// if we can, stop further interactions
for (hand in Hands.VALUES) {
if (hand == Hands.OFF && !connection.version.hasOffhand) {
// only one hand available
return
}
val stack = connection.player.items.inventory[hand]
if (target != null && short.tryUse(hand, target, stack)) {
@ -115,12 +119,6 @@ class UseHandler(
return
}
sendItemUse(hand, stack)
if (!connection.version.hasOffhand) {
// only one hand available
return
}
}
}