Leash animal API ?

A new update (0.9.2) is available now!
Latest Hotfix: 0.9.2.1 (2026-05-13)
  • Hi!


    I try to control, via API, when animals can be leashed with a rope. I looked in API but not yet any clue how to detect when a player leash a animal and eventually deny this if some conditions are meet. If any have any hint, that will be very appreciated!


    Thx.


    Bamse

  • I make some progress but i don't know how to cancel PlayerMouseButtonEvent (it seems this event don't have setCanceled(true) method ...


    But i even if find a method to cancel mouse press button i don't think this is the best approach because left button is used very heavy in game ..


    Idealy i want some Event who is triggered on start of special action of equipped item like "Catch Animal", "Shear sheep", etc ...


  • Unfortunately this is not exposed to the API yet :/ This is because this game mechanic isn't fully implemented yet...

    But maybe I can still get an event (e.g. "PlayerNpcLeashEvent" or smth like that) added with the next hotfix ^^


    About shearing sheeps, basically this is handled by PlayerNpcInteractionEvent, but I just realized that this is way too limited... this definitely needs some better handling which provides more information about the actual interaction type. Right now it's triggered if you just press F, but it's also triggered when shearing sheeps etc. I will put this on my list (but I'm not sure if this will make it into the next hotfix)!

  • About shearing sheeps, basically this is handled by PlayerNpcInteractionEvent, but I just realized that this is way too limited... this definitely needs some better handling which provides more information about the actual interaction type. Right now it's triggered if you just press F, but it's also triggered when shearing sheeps etc. I will put this on my list (but I'm not sure if this will make it into the next hotfix)!

    Here i think about a more generic event like PlayerUseAction. This can be triggered basically when player use equipped item, like rope to leash, shear to shear a shep, knife to skin, knife on tanning rack, bucket to get milk, bucket to get water, etc. and maybe more like use on bread to get half bread, on melon to get slices, etc.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!