Left click animation with offhand - Is it possible?

Discussion in 'Spigot Plugin Development' started by Hibrocolomedio, Nov 10, 2018.

  1. I was wondering if it's possible to trigger an animation when the item in the player's offhand is attacking. I am asking if this is possible via the SpigotAPI, so it looks so for the player, which's hand is being animated or for other players only (it might only be the last). Maybe something with ProtocolLib?

    I think I have seen this somewhere, but I am not 100% sure, that's why I am asking if this is possible, which I don't think it is.
  2. It is definitely not possible with the Spigot API
  3. It's possible using packets: https://wiki.vg/Protocol#Animation_.28clientbound.29. In this case the packet would be something like this:
    Code (Text):
    new PacketPlayOutAnimation(entity.getEntityId(), 3)
    • Like Like x 1
  4. Agreed. And it works. I already made a plugin years ago that allowed you to control other players. To other players you were invisible, so it looked like you are controlling the other player and I used that packet whenever the controlling player clicked, so it looks like the player being controlled breaks the blocks.
  5. Thanks for your replies.
    I wonder if I send the packet to the player themselfs whether they will see the offhand swinging.
  6. lol. overconfident much?
  7. Please try that. I can't remember right but I think they do not see it :/
  8. Actually, in some sort of way, @Alex_qp was right, cause Packets are native minecraft server code, so not Spigot API. You are accessing Mojang code.
    • Like Like x 1
  9. I'll just use ProtocolLib, not bothering with NMS.
  10. Sure :) everyone should do it as he wants. I never did anything with ProtocolLib ^^ Should really look into it when I have some free time.

Share This Page