@minecraft
    正在准备搜索索引...

    类 EntityLeashableComponent

    Allows the entity to be leashed. Defines the conditions and events for when an entity is leashed.

    层级 (查看层级一览)

    索引
    canBeStolen: boolean

    Returns true if another entity can 'steal' the leashed entity by attaching their own leash to it.

    entity: Entity

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

    hardDistance: number

    Distance in blocks at which the leash stiffens, restricting movement.

    isLeashed: boolean

    Returns true if the entity is leashed.

    isValid: boolean

    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.

    leashHolder?: Entity

    Entity that is holding the leash.

    leashHolderEntityId?: string

    Identifier of entity that is holding the leash.

    maxDistance: number

    Distance in blocks at which the leash breaks.

    softDistance: number

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

    typeId: string

    Identifier of the component.

    componentId: "minecraft:leashable" = 'minecraft:leashable'
    • 世界修改

      参数

      • leashHolder: Entity

        The entity to leash this entity to.

      返回 void

      Leashes this entity to another entity.

      Throws if the entity to leash to is over the max distance, and if the player is dead or in spectator mode.

    • 世界修改

      返回 void

      Unleashes this entity if it is leashed to another entity.