mojira.dev
MCPE-228197

Breaking a lead that is attached to a fence doesn't trigger minecraft:on_unleash

In developing an add-on, I’ve discovered that when breaking a lead that is attached between an entity and a fence post, the minecraft:on_unleash event trigger is not activated.

Here is the relevant code I’ve been using to test this:

[.....]
        "minecraft:leashable": {
          "on_leash": {
            "event": "omb:leash_combo",
            "target": "self"
          },
          "on_unleash": {
            "event": "omb:unleash_combo",
            "target": "self"
          }
        },
[.....]
      "events": {
        "omb:leash_combo": {
          "sequence": [
            {
              "trigger": "minecraft:on_leash"
            },
            {
              "trigger": "omb:on_leash"
            }
          ]
        },
        "omb:unleash_combo": {
          "sequence": [
            {
              "trigger": "minecraft:on_unleash"
            },
            {
              "trigger": "omb:on_unleash"
            }
          ]
        },
        "omb:on_leash": {
          "queue_command": {
            "command": "tag @s add leashed"
            }
          },
        "omb:on_unleash": {
          "queue_command": {
            "command" : "tag @s remove leashed"
          }
        },
[.....]

With this code included in my add-on, the tag “leashed” is applied whenever an entity has a lead attached to it. The tag persists until the player personally removes a lead from the entity.

If the player hitches the entity to a fence and then breaks the lead, the “leashed” tag is not removed. The player is forced to re-attach a lead to the entity and then break it directly.

Attachments

Comments 6

Could you please attach an example addon showcasing the issue?

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

[media]

Here’s the add-on I've been working on.

To see the issue, summon omb:pet_bat and feed it a gold nugget to tame it, then you'll be able to attach a lead.

If you list the tags, you can see that the “leashed” tag is applied when a lead is attached, but will only be removed when the player physically removes the lead- not when the lead is broken.

It is also possible that I don't know what I am doing. More than possible, actually.

Not super important for this issue, but here’s an updated version of the Pet Bats add-on. Fixed a few errors that I missed in the previously-uploaded one.

[media]

I can verify this too, using scripting API as well, whether you unleashed via breaking the block the lead is attached to or going away super far that the leash break, it will not trigger the on_unleash event. This is actually because the docs lied! on_unleash_interact_only default value is actually set to true! Adding, "on_unleash_interact_only": false will now work as intended.

I guess this can be closed as “Won’t Fix” or “Works as Intended” per this comment: https://github.com/MicrosoftDocs/minecraft-creator/issues/962#issuecomment-3553274424

Tim

(Unassigned)

1504033

Confirmed

Windows

Windows 10 Pro 22H2

1.21.130.20 Preview, 1.21.101 Hotfix

Retrieved