Knife/PlayerInteractEvent

Discussion in 'Plugin Development' started by bodhistrontg, Dec 23, 2013.

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

    bodhistrontg

    So i was wondering how to like if the player left clicks air it will set item in hand to diamond sword then the sword will attack and then what ever item was in there had before the diamond sword reapers and the diamond sword disapears sorry if im being confusing thank you!
     
  2. Offline

    Gater12

    bodhistrontg You can get the player's item in hand, assign it to the variable, assign the player's item in hand to a diamond sword, then assign it back to the variable.
     
  3. Offline

    bodhistrontg

    Okay :D but how would you make it so when they are holing the sword they attack with it.
     
  4. Offline

    xTigerRebornx

  5. Offline

    bodhistrontg

  6. Offline

    LegoPal92

  7. Offline

    xTigerRebornx

    LegoPal92 You could make the server think they attacked, but I don't think you could force the client to actually swing their weapon
     
  8. Offline

    LegoPal92

    I beg to differ.
    Code:
            EntityPlayer p = ((CraftPlayer)player).getHandle();
            p.netServerHandler.sendPacket(p, new PacketPlayInArmAnimation(p, 1));
    Of course this requires NMS, and a bit of protocol knowledge, but a simple google search can accomplish this. It also requires CraftBukkit, but I'm sure that that is not a problem.

    EDIT: I guess I'll hand out a link to the protocol for it: http://wiki.vg/Protocol#Animation
     
  9. Offline

    xTigerRebornx

    LegoPal92 Eh, I don't use NMS much, but if its possible, its possible. If the OP would like to use NMS, then the OP can use NMS
     
Thread Status:
Not open for further replies.

Share This Page