minecraft:leashable for you with a switch.Get GodCraftOverview
minecraft:leashable is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets players tie the entity to a lead, and fires events when it is leashed or freed.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
can_be_cut | Boolean | "true" | Lets players use shears on the entity to cut its leads. |
can_be_stolen | Boolean | "true" | Lets players leash the entity even when it is already leashed to someone else. |
on_leash | String | none | Event fired when the entity is leashed. |
on_unleash | String | none | Event fired when the entity is freed. |
on_unleash_interact_only | Boolean | "false" | Only fire the unleash event when a player frees it directly. |
presets | List | none | Leash settings such as distances and spring strength; the first preset whose filter passes is used. |
unleash_on_removal | Boolean | "true" | Frees the entity when this component is removed. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:leashable": {
"can_be_cut": "true",
"can_be_stolen": "true",
"on_leash": "",
"on_unleash": "",
"on_unleash_interact_only": "false",
"presets": {},
"unleash_on_removal": "true"
}
}