Package net.ixdarklord.folios.api.client
Class FoliosGuides
java.lang.Object
net.ixdarklord.folios.api.client.FoliosGuides
Guide books on the client: the books loaded from resource packs, and opening them.
A book is a folder of JSON in a resource pack, so resource packs can add, translate and replace them, and
F3 + T reloads them while you write:
assets/mymod/folios/handbook/
book.json name, subtitle, landing (the first page's text), style, accent, cover, icon, tilt, distance, page_turn,
textures (page, frame, cover, tab, tab_plate, backdrop), layout
categories/basics.json name, description, icon, sort, color (its tab)
entries/basics/first_steps.json name, category, icon, sort, featured, pages: [...]
Text anywhere can be a translation key, and is written in a small Markdown
(FoliosText); the kinds of page are listed in
FoliosPageElements, and a book's "style" picks how it is
shown (FoliosStyles). Categories, entries and pages can be locked behind advancements or flags
(FoliosLock).
FoliosGuides.open(MyMod.id("handbook"));
FoliosGuides.open(MyMod.id("handbook"), "basics/first_steps");
FoliosGuides.setFlag("mymod:hard_mode", () -> MyConfig.HARD_MODE.get());
The server can open books too, and give them as items: FoliosBooks.-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable FoliosBookbook(net.minecraft.resources.ResourceLocation id) static Collection<FoliosBook> books()static booleanWhether an entry of a book has been opened by the player (kept between games).static booleanopen(net.minecraft.resources.ResourceLocation book) Opens a book where the player left off (or at its start), in its own style; false when there is no such book.static booleanOpens a book at an entry ("category/entry", optionally with"#marker").static voidrefresh()Lays every book out again at its next drawing, for after something its locks depend on changed.static voidsetFlag(String flag, BooleanSupplier value) Sets a flag that entries can be locked behind ("flag": "mymod:hard_mode"in their JSON).
-
Method Details
-
book
-
books
-
open
public static boolean open(net.minecraft.resources.ResourceLocation book) Opens a book where the player left off (or at its start), in its own style; false when there is no such book. -
open
Opens a book at an entry ("category/entry", optionally with"#marker").- Returns:
- false when there is no such book or entry, or the entry is locked
-
isRead
Whether an entry of a book has been opened by the player (kept between games). -
setFlag
Sets a flag that entries can be locked behind ("flag": "mymod:hard_mode"in their JSON). It is asked whenever a book is laid out; callrefresh()when its answer changes while a book may be open. -
refresh
public static void refresh()Lays every book out again at its next drawing, for after something its locks depend on changed.
-