When the content of page contains text that may be regarded as an object (e.g. number only or {“name”:”string”}), the script won’t regard it as a string content but a rawMessage content (returns {})
Steps to reproduce
Basically a writable book, a pack that is capable to use ItemBookComponent.contents/ItemBookComponent.rawContents API
Input 1 in page 1 of the book. Input {“rawtext”:[{“text”:”1”}]} in page 2.
Place the book in the first slot of hotbar. So that you may use player.getComponent(“minecraft:inventory”).container.getItem(0).getComponent(“minecraft:book”).contents OR use the pack down below.
Observed result
contents is [undefined,undefined], rawContents is [{},{text:”1”}]
Expected result
contents is [1,undefined], rawContents is [undefined,{text:”1”}]
Attachments
Comments 5
How to use the pack
use “Debug”
click “Editor Mode”
click “Item”
choose “Inventory” in the dropdown list, input “0” in the textfield, then submit
the value of the slider named after “Write” refers to the number of page you want to check, then submit
the first textfield is the content detected in this page. Please note, when getRawContent() returns {}, it is shown as {“rawtext”:[{}]} in the textField
the key code in line 678:
.textField({translate: "portfolioScreen.page", with: [String(pageNum)]}, {translate: "type:JSON"}, {defaultValue: book.getPageContent(pageNum-1)??`{"rawtext":[${JSON.stringify(book.getRawPageContent(pageNum-1)??{})}]}`})
Your report does not have enough information to reproduce the issue.
Please include the following information to help us understand your problem:
Refer to the Bug Tracker Guidelines for more information about how to write helpful bug reports. Bug reports with insufficient information may be closed as Incomplete.
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki