Class: EntityAgeableComponent
entity componentBeta
为实体添加成长计时器。可以通过给予实体其喜好的物品(由 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
readonlyduration: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
readonlyentity: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.
Inherited from
growUp
readonlygrowUp:Trigger
Beta
Remarks
此实体成长时触发的事件。
Event that runs when this entity grows up.
Throws
This property can throw when used.
isValid
readonlyisValid: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
transformToItem
readonlytransformToItem:string
Beta
Remarks
使用的饲料物品在成功交互后将转化为此物品。
The feed item used will transform into this item upon successful interaction.
Throws
This property can throw when used.
typeId
readonlytypeId:string
Beta
Remarks
组件的标识符。
Identifier of the component.
Inherited from
componentId
readonlystaticcomponentId:"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
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.
