Even though I have the InputPermission for Dismount disabled, the button for Sneak is never reported as “Pressed” while a player is riding
I have an ridable entity in my addon. I want to be able to control additional movements of the entity based on the player pressing Sneak or Jump. The player dismounts using other game mechanics.
I have disabled the player's input for both Jump and Dismount:
player.inputPermissions.setPermissionCategory(InputPermissionCategory.Jump, false);
player.inputPermissions.setPermissionCategory(InputPermissionCategory.Dismount, false);
I then use the PlayerButtonInputAfterEvent to show a message when a button is pressed or released:
world.afterEvents.playerButtonInput.subscribe((event) => {
const { button, newButtonState, player } = event;
player.sendMessage(button + ":" + newButtonState);
});
This event is never fired while the player is riding an entity. It is correctly fired when I use the jump button.
I have also tried reading the player’s InputInfo directly:
let jumpPressed = player.inputInfo.getButtonState(InputButton.Jump);
let sneakPressed = player.inputInfo.getButtonState(InputButton.Sneak);
This always returns “Released” for the sneak button. The jump button responds correctly.
In the InputButton Enumeration documentation, it states
Dismounting a horse or exiting a boat will not send a Sneak button change event.
But, if dismounting is disabled, then I would expect the Sneak button to trigger the event.
Testing on 1.21.90.27 Preview using @minecraft/server 2.0.0. I have not tested this in previous versions, or 2.1.0 beta
Comments 0
No comments.