Listening for clicking on an entity

Discussion in 'Plugin Development' started by Crash, Mar 13, 2011.

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

    Crash

    Is there a way to know when somebody has right clicked on an entity, say a cow/chicken/etc.
    I have the instance of the craft mob if that would help.
     
  2. Offline

    Edward Hand

    It's possible (my MobRider plugin uses it) but not without getting your hands dirty hacking into the minecraft server classes.

    To detect right click you use PLAYER_ITEM I think it is.

    As for detecting the mob, that's the tricky bit. I outlined the basic principals in this post:
    http://forums.bukkit.org/threads/monsters-in-an-area.7386/
     
  3. Offline

    eltorqiro

    Excellent info, Edward, I hadn't seen your previous thread and this helped a lot :)

    @Crash As an alternative, if your primary goal is to do something when a player "interacts" with a mob, my workaround for the same situation was to remove punching as a valid option for damaging a creature, and thus use punching as my means of "interaction". With the appropriate damage event hooks etc, this worked quite well.
     
Thread Status:
Not open for further replies.

Share This Page