Feature: API to switch items in the offhand/mainhand (#4819)

This commit is contained in:
chris 2024-07-14 22:09:55 +02:00 committed by GitHub
parent 51a1295139
commit b213fb5139
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -81,4 +81,10 @@ public interface EntityData {
* @return whether the movement is locked
*/
boolean isMovementLocked();
/**
* Sends a request to the Java server to switch the items in the main and offhand.
* There is no guarantee of the server accepting the request.
*/
void switchHands();
}

View file

@ -96,4 +96,9 @@ public class GeyserEntityData implements EntityData {
public boolean isMovementLocked() {
return !movementLockOwners.isEmpty();
}
@Override
public void switchHands() {
session.requestOffhandSwap();
}
}