Triggering/Cancelling Right Arm Swing Animation

Discussion in 'Plugin Development' started by aByteofMight, Jul 2, 2023.

Thread Status:
Not open for further replies.
  1. Offline


    Hi all,

    For starters, I hope I'm not breaking any rules in making this post. This is my first time writing on and I'm trying to make sure I'm not posting in the wrong place! Nevertheless, I don't have a bug but more-so a question. I'll give you the scenario.

    So, I've been writing my own plugins the last couple of days to modify v1.20.1 to my liking. I've been getting a lot of cool progress done and I'm blown away with what I've been able to achieve with some lines of code.

    Today, I was messing around with the EventHandler onPlayerInteract() method and was able to cancel the right click event of any block of my choosing. I've learned that, while you can cancel interaction with any block, this has no effect on the player right-arm interaction/swing animation.

    I was wondering, when I don't want players to be able to interact with a block, is there a way that I can prevent the right arm swing animation from triggering? Or perhaps there is a way to give the illusion of cancelling the arm swing animation by quickly changing a mutable value without players noticing so it appears as if nothing happened when they right clicked this block.

    As is, even if a PlayerInteractEvent is cancelled, animations still trigger as if the block were interactable.

    This is a very quirky and even nit-picky change I'm looking to make and I respectfully understand if there's no such implementation of what I'll dub "AnimationTriggerEvents", this may be something that requires a mod in the player's client, not entirely sure.

    Some info on this subject would be greatly appreciated.

    Thank you for your time,

    Sorry, here's what I was looking for. I'll leave the post up incase this helps anyone else

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 2, 2023
  2. Offline


    You can utilize the PlayerAnimationEvent here:

    This can cancel server-sided animations, effectively stopping the swing animation for other players. However, the swing animation for the player themselves is client-sided, so I am pretty sure you are not able to stop that one.
Thread Status:
Not open for further replies.

Share This Page