@minecraft
    正在准备搜索索引...

    类 ItemBookComponent实验性

    When present on an item, this item is a book item. Can access and modify the contents of the book and sign it.

    层级 (查看层级一览)

    索引

    属性

    author?: string

    The name of the author of the book if it is signed, otherwise undefined.

    This property can throw when used.

    InvalidItemStackError

    contents: string[]

    The contents of pages in the book that are in string format. Entries not in string format will be undefined.

    This property can throw when used.

    InvalidItemStackError

    isSigned: boolean

    Determines whether the book has been signed or not.

    This property can throw when used.

    InvalidItemStackError

    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.

    pageCount: number

    The amount of pages the book has.

    This property can throw when used.

    InvalidItemStackError

    rawContents: RawMessage[]

    The contents of pages in the book that are in RawMessage format. Entries not in RawMessage format will be undefined.

    This property can throw when used.

    InvalidItemStackError

    title?: string

    The title of the book if it is signed, otherwise undefined.

    This property can throw when used.

    InvalidItemStackError

    typeId: string

    Identifier of the component.

    componentId: "minecraft:book" = 'minecraft:book'

    方法

    • 参数

      • pageIndex: number

        The index of the page.

      返回 string

      The content of the page if a valid index is provided and it is in string format, otherwise returns undefined.

      Gets the string format content of a page for a given index.

      This function can throw errors.

      InvalidItemStackError

    • 世界修改

      参数

      • pageIndex: number

        The index of the page.

      返回 void

      Removes a page at a given index. Existing pages following this page will be moved backward to fill the empty space.

      This function can throw errors.

      InvalidItemStackError

    • 世界修改

      参数

      • pageIndex: number

        The index of the page.

      • content: string | RawMessage | (string | RawMessage)[]

        The content to set for the page. Can be a single string or RawMessage or an array of strings and/or RawMessages

      返回 void

      Sets or creates the content of a specific page. Empty pages will be created if the index is greater than the current book size. Pages have a maximum limit of 256 characters for strings as well as the JSON representation of a RawMessage. Books have a maximum limit of 50 pages.

      This function can throw errors.

      BookError

      BookPageContentError

      InvalidItemStackError

    • 世界修改

      参数

      • title: string

        The title to give the book.

      • author: string

        The name of the book's author.

      返回 void

      Signs a book giving it a title and author name. Once signed players can no longer directly edit the book. Titles have a maximum character limit of 16.

      This function can throw errors.

      BookError

      InvalidEntityError

      InvalidItemStackError