Class: BlockInstrumentComponent experimental
block componentBeta
表示方块可在上表面与下表面分别设置的乐器。
Represents the instruments a block can have assigned to it's up and down faces.
Extends
Properties
block
readonlyblock:Block
Beta
Remarks
此组件所属的方块。
Block instance that this component pertains to.
Inherited from
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
typeId
readonlytypeId:string
Beta
Remarks
组件的标识符。
Identifier of the component.
Inherited from
componentId
readonlystaticcomponentId:"minecraft:instrument_sound"='minecraft:instrument_sound'
Beta
Methods
getInstrumentName()
getInstrumentName(
face):string
Beta
Parameters
face
要获取乐器名称的面 Direction。
the face Direction to get the instrument name for.
Returns
string
返回给定有效面 Direction 的乐器名称。
Returns the name of the instrument for a given valid face Direction.
Remarks
获取方法,用于获取给定有效面 Direction 的乐器名称。
A getter method to get the name of an instrument for a given valid face Direction.
Throws
This function can throw errors.
LocationOutOfWorldBoundariesError
playInstrumentSound()
playInstrumentSound(
face,soundOptions?):void
World Mutation Beta
Parameters
face
要播放乐器声音的面 Direction。
the face Direction for which instrument sound to play.
soundOptions?
播放乐器声音时使用的可选 WorldSoundOptions;如果省略,则使用默认值。
optional WorldSoundOptions to use when playing the insturment sound; if omitted the default values are used.
Returns
void
Remarks
在组件的方块位置播放给定有效面 Direction 的乐器声音,使用可选的 WorldSoundOptions。
plays the instrument sound for a given valid face Direction at the components block location using optional WorldSoundOptions.
Throws
This function can throw errors.
LocationOutOfWorldBoundariesError
