@minecraft/server
    Preparing search index...

    Class BlockInstrumentComponentBeta

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

    Hierarchy (View Summary)

    Index

    Properties

    block: Block

    Block instance that this component pertains to.

    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.

    typeId: string

    Identifier of the component.

    componentId: "minecraft:instrument_sound" = 'minecraft:instrument_sound'

    Methods

    • Beta

      Parameters

      • face: Direction

        the face Direction to get the instrument name for.

      Returns string

      Returns the name of the instrument for a given valid face Direction.

      A getter method to get the name of an instrument for a given valid face Direction.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError

    • Beta

      Parameters

      • face: Direction

        the face Direction for which instrument sound to play.

      • OptionalsoundOptions: WorldSoundOptions

        optional WorldSoundOptions to use when playing the insturment sound; if omitted the default values are used.

      Returns void

      plays the instrument sound for a given valid face Direction at the components block location using optional WorldSoundOptions.

      This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.InvalidArgumentError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError