类 EntityBreathableComponent实验性

定义实体可以在何种方块中呼吸,并赋予它们窒息的能力。

Defines what blocks this entity can breathe in and gives them the ability to suffocate.

层级 (查看层级一览)

属性

airSupply: number

表示实体当前的空气供应量。

The current air supply of the entity.

无法在只读模式下修改此属性,详见 WorldBeforeEvents

若空气供应超出范围 [suffocationTime, maxAirSupply],将抛出错误。

Will throw an error if the air supply is out of bounds [suffocationTime, maxAirSupply].

breathesAir: boolean

若为 true,则表示该实体可以在空气中呼吸。

If true, this entity can breathe in air.

使用时可能抛出错误。

This property can throw when used.

breathesLava: boolean

若为 true,则表示该实体可以在岩浆中呼吸。

If true, this entity can breathe in lava.

使用时可能抛出错误。

This property can throw when used.

breathesSolids: boolean

若为 true,则表示该实体可以在固体方块中呼吸。

If true, this entity can breathe in solid blocks.

使用时可能抛出错误。

This property can throw when used.

breathesWater: boolean

若为 true,则表示该实体可以在水中呼吸。

If true, this entity can breathe in water.

使用时可能抛出错误。

This property can throw when used.

canBreathe: boolean

若为 true,则表示该实体能够呼吸。

If true, the entity is able to breathe.

使用时可能抛出错误。

This property can throw when used.

entity: Entity

拥有此组件的实体。若该实体已被移除,则为 undefined。

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

使用时可能会抛出异常。

This property can throw when used.

InvalidEntityError

generatesBubbles: boolean

若为 true,则表示该实体在水中时会有可见的气泡。

If true, this entity will have visible bubbles while in water.

使用时可能抛出错误。

This property can throw when used.

inhaleTime: number

表示恢复到最大呼吸所需的时间(以秒为单位)。

Time in seconds to recover breath to maximum.

使用时可能抛出错误。

This property can throw when used.

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.

suffocateTime: number

表示窒息伤害之间的时间间隔(以秒为单位)。

Time in seconds between suffocation damage.

使用时可能抛出错误。

This property can throw when used.

totalSupply: number

表示实体可以屏住呼吸的时间(以秒为单位)。

Time in seconds the entity can hold its breath.

使用时可能抛出错误。

This property can throw when used.

typeId: string

组件的标识符。 Identifier of the component.

componentId: "minecraft:breathable" = 'minecraft:breathable'

方法

  • 实验性

    返回 BlockPermutation[]

    表示该实体可以呼吸的方块列表,除了分类的方块属性外。

    List of blocks this entity can breathe in, in addition to the separate properties for classes of blocks.

    调用此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    返回 BlockPermutation[]

    表示该实体不能呼吸的方块列表。

    List of blocks this entity can't breathe in.

    调用此函数可能会抛出错误。

    This function can throw errors.