Skip to content

Commit

Permalink
Feature: API to switch items in the offhand/mainhand (GeyserMC#4819)
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris authored and letsgoawaydev committed Jul 21, 2024
1 parent a9c6d8b commit 96aecd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public boolean lockMovement(boolean lock, @NonNull UUID owner) {
public boolean isMovementLocked() {
return !movementLockOwners.isEmpty();
}

@Override
public void switchHands() {
session.requestOffhandSwap();
}
}

0 comments on commit 96aecd2

Please sign in to comment.