类 EntityAgeableComponent实验性

为实体添加一个成长计时器。可以通过喂给实体它喜欢的物品(由 feedItems 定义)来加速成长。

Adds a timer for the entity to grow up. It can be accelerated by giving the entity the items it likes as defined by feedItems.

层级 (查看层级一览)

属性

duration: number

表示实体成长为成年所需的时间,-1 表示永远是幼体。

Amount of time before the entity grows up, -1 for always a baby.

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

growUp: Trigger

表示当实体成长为成年时触发的事件。

Event that runs when this entity grows up.

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.

transformToItem: string

表示成功交互后,喂食的物品将转化为的物品。

The feed item used will transform into this item upon successful interaction.

This property can throw when used.

typeId: string

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

componentId: "minecraft:ageable" = 'minecraft:ageable'

方法

  • 实验性

    返回 string[]

    表示实体成长为成年时掉落的物品列表。

    List of items that the entity drops when it grows up.

    This function can throw errors.

  • 实验性

    返回 EntityDefinitionFeedItem[]

    表示可以喂给实体的物品列表。包括物品名称的 'item' 和定义成长时间的 'growth'。

    List of items that can be fed to the entity. Includes 'item' for the item name and 'growth' to define how much time it grows up by.

    This function can throw errors.