Closed DaFuqs closed 3 months ago
huh that is an odd one. I'll have to investigate, thanks for reporting
@DaFuqs I looked into it a bit now and I did not consider your use case when setting up the system. Can you try if calling openBook before your openEntry works for you? It should set up the state properly and if done without delay I think it should not cause any render weirdness but it would be good to test
Can confirm that by changing
if (hasOpenedGuidebookBefore()) {
BookGuiManager.get().openBook(GUIDEBOOK_ID);
} else {
BookGuiManager.get().openEntry(GUIDEBOOK_ID, entry, page);
}
to
BookGuiManager.get().openBook(GUIDEBOOK_ID);
if (!hasOpenedGuidebookBefore()) {
BookGuiManager.get().openEntry(GUIDEBOOK_ID, entry, page);
}
the icon shows up and the book is getting built correctly. I did not notice anything weird rendering wise, no flickering of the main view before opening the entry.
How about doing the initialisations on Modonomicons end using openEntry()
, too, or calling openBook()
internally before? In case someone else stumbles upon this.
@DaFuqs thanks for testing! Your suggestion makes sense but I would prefer to guide people towards calling both. The reason being, modonomicon uses openEntry internally if the book is already open, and I am not sure if everything is hardened against repeat calls of openBook.
I will close this as we got the bug out of the way, but we can discuss further. I believe pointing people to this issue and your illustrative resolution comment should be sufficient that this is no longer a problem going forward, but if there are further considerations I am open to look into it more
Describe the bug / To Reproduce I implement a custom guidebook item that opens an introduction entry when first opened or certain milestones have been reached. To achive this, instead of opening the book with
BookGuiManager.get().openBook(GUIDEBOOK_ID);
I useBookGuiManager.get().openEntry(GUIDEBOOK_ID, <my_entry_id>, 0);
.When returning to the category screen from that entry, the "mark all unlocked entries as read" button will not show, despite there being unread entries. After I open a yet unread entry after that and go back it will start to show up.
The issue persists even opening and closing the book using
BookGuiManager.get().openEntry(GUIDEBOOK_ID, <my_entry_id>, 0);
multiple times. The button always shows up correctly when just usingBookGuiManager.get().openBook(GUIDEBOOK_ID)
.I have not looked into it in detail yet, but openBook() runs quite a bit more code (including sanity checks) than openEntry(), so maybe that is the issue already.
Expected behavior The button to show up
Screenshots Category view after joining a world and opening a book with![image](https://github.com/klikli-dev/modonomicon/assets/26429514/7ec39126-318e-48a2-8b02-ced2206b5285)
BookGuiManager.get().openEntry(GUIDEBOOK_ID, <my_entry_id>, 0);
and going back to the category view: the "Read All" button is missingSystem (please complete the following information):