Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Extends
Allows the entity to be leashed. Defines the conditions and events for when an entity is leashed.
Properties
canBeStolen
read-only canBeStolen: boolean;
Returns true if another entity can 'steal' the leashed entity by attaching their own leash to it.
Type: boolean
Notes:
- This property can throw errors when used.
hardDistance
read-only hardDistance: number;
Distance in blocks at which the leash stiffens, restricting movement.
Type: number
Notes:
- This property can throw errors when used.
isLeashed
read-only isLeashed: boolean;
Returns true if the entity is leashed.
Type: boolean
Notes:
- This property can throw errors when used.
leashHolder
read-only leashHolder?: Entity;
Entity that is holding the leash.
Type: Entity
Notes:
- This property can throw errors when used.
leashHolderEntityId
read-only leashHolderEntityId?: string;
Identifier of entity that is holding the leash.
Type: string
Notes:
- This property can throw errors when used.
maxDistance
read-only maxDistance: number;
Distance in blocks at which the leash breaks.
Type: number
Notes:
- This property can throw errors when used.
softDistance
read-only softDistance: number;
Distance in blocks at which the 'spring' effect starts acting to keep this entity close to the entity that leashed it.
Type: number
Notes:
- This property can throw errors when used.
Methods
leashTo
leashTo(leashHolder: Entity): void
Leashes this entity to another entity.
Parameters
leashHolder: Entity
The entity to leash this entity to.
Notes:
- This function can't be called in restricted-execution mode.
- This function can throw errors.
- Throws if the entity to leash to is over the max distance, and if the player is dead or in spectator mode.
unleash
unleash(): void
Unleashes this entity if it is leashed to another entity.
Notes:
- This function can't be called in restricted-execution mode.
- This function can throw errors.
Constants
componentId
static read-only componentId = "minecraft:leashable";
Type: string