Skip to main content

Class: EntityLeashableComponent

Allows this entity to be leashed and defines the conditions and events for this entity when is leashed.

Extends

Constructors

new EntityLeashableComponent()

private new EntityLeashableComponent(): EntityLeashableComponent

Returns

EntityLeashableComponent

Overrides

EntityComponent . constructor

Properties

entity

Beta

readonly entity: Entity

Remarks

The entity that owns this component. The entity will be undefined if it has been removed.

Inherited from

EntityComponent . entity


softDistance

readonly softDistance: number

Remarks

Distance in blocks at which the 'spring' effect starts acting to keep this entity close to the entity that leashed it.

Throws

This property can throw when used.


typeId

readonly typeId: string

Remarks

Identifier of the component.

Inherited from

EntityComponent . typeId


componentId

static readonly componentId: "minecraft:leashable" = 'minecraft:leashable'

Methods

isValid()

isValid(): boolean

Returns

boolean

Whether the component is valid.

Inherited from

EntityComponent . isValid

Remarks

Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.


leash()

leash(leashHolder): void

Parameters

ParameterTypeDescription
leashHolderEntityThe entity to leash this entity to.

Returns

void

Remarks

Leashes this entity to another entity.

This function can't be called in read-only mode.

Throws

This function can throw errors.


unleash()

unleash(): void

Returns

void

Remarks

Unleashes this entity if it is leashed to another entity.

This function can't be called in read-only mode.

Throws

This function can throw errors.