类 BlockRecordPlayerComponent实验性

表示一个可以播放唱片的方块。

Represents a block that can play a record.

层级 (查看层级一览)

属性

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:record_player" = 'minecraft:record_player'

方法

  • 实验性

    返回 void

    弹出当前设置的唱片。

    Ejects the currently set record of this record-playing block.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    返回 ItemStack

    获取当前设置在此唱片播放方块上的唱片。

    Gets the currently set record of this record-playing block.

    此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    返回 boolean

    若唱片播放方块当前正在播放唱片,则返回 true

    Returns true if the record-playing block is currently playing a record.

    此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    返回 void

    暂停当前正在播放的唱片。

    Pauses the currently playing record of this record-playing block.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    返回 void

    播放当前设置在此唱片播放方块上的唱片。

    Plays the currently set record of this record-playing block.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    此函数可能会抛出错误。

    This function can throw errors.

  • 实验性

    参数

    • 可选recordItemType: string | ItemType
    • 可选startPlaying: boolean

    返回 void

    根据物品类型设置并播放一张唱片。

    Sets and plays a record based on an item type.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    此函数可能会抛出错误。

    This function can throw errors.