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/BlockInstrumentComponent.md.

Class: BlockInstrumentComponent experimental

block component

Beta

表示方块可在上表面与下表面分别设置的乐器。

Represents the instruments a block can have assigned to it's up and down faces.

Extends

Properties

block

readonly block: Block

Beta

Remarks

此组件所属的方块。

Block instance that this component pertains to.

Inherited from

BlockComponent.block


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

BlockComponent.isValid


typeId

readonly typeId: string

Beta

Remarks

组件的标识符。

Identifier of the component.

Inherited from

BlockComponent.typeId


componentId

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

Beta

Methods

getInstrumentName()

getInstrumentName(face): string

Beta

Parameters

face

Direction

要获取乐器名称的面 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.

InvalidArgumentError

LocationInUnloadedChunkError

LocationOutOfWorldBoundariesError


playInstrumentSound()

playInstrumentSound(face, soundOptions?): void

World Mutation Beta

Parameters

face

Direction

要播放乐器声音的面 Direction。

the face Direction for which instrument sound to play.

soundOptions?

WorldSoundOptions

播放乐器声音时使用的可选 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.

InvalidArgumentError

LocationInUnloadedChunkError

LocationOutOfWorldBoundariesError

同领域相关