For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/classes/EntityAgeableComponent.md.

Class: EntityAgeableComponent

entity component

Beta

为实体添加成长计时器。可以通过给予实体其喜好的物品(由 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.

Extends

Properties

duration

readonly duration: number

Beta

Remarks

实体成长前的剩余时间,-1 表示始终为幼年体。

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

Throws

This property can throw when used.


entity

readonly entity: Entity

Beta

Remarks

拥有此组件的实体。如果实体已被移除,则实体将为 undefined

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

Throws

This property can throw when used.

InvalidEntityError

Inherited from

EntityComponent.entity


growUp

readonly growUp: Trigger

Beta

Remarks

此实体成长时触发的事件。

Event that runs when this entity grows up.

Throws

This property can throw when used.


isValid

readonly isValid: boolean

Beta

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.

Inherited from

EntityComponent.isValid


transformToItem

readonly transformToItem: string

Beta

Remarks

使用的饲料物品在成功交互后将转化为此物品。

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

Throws

This property can throw when used.


typeId

readonly typeId: string

Beta

Remarks

组件的标识符。

Identifier of the component.

Inherited from

EntityComponent.typeId


componentId

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

Beta

Methods

getDropItems()

getDropItems(): string[]

Beta

Returns

string[]

Remarks

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

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

Throws

This function can throw errors.


getFeedItems()

getFeedItems(): EntityDefinitionFeedItem[]

Beta

Returns

EntityDefinitionFeedItem[]

Remarks

可以喂给实体的物品列表。包含 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.

Throws

This function can throw errors.

同领域相关