Class Guides

java.lang.Object
net.ixdarklord.folios.api.client.Guides

public final class Guides extends Object
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 (GuideText); the kinds of page are listed in GuidePageTypes, and a book's "style" picks how it is shown (GuideStyles). Categories, entries and pages can be locked behind advancements or flags (GuideLock).

 Guides.open(MyMod.id("handbook"));
 Guides.open(MyMod.id("handbook"), "basics/first_steps");
 Guides.setFlag("mymod:hard_mode", () -> MyConfig.HARD_MODE.get());
 
The server can open books too, and give them as items: GuideBooks.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable GuideBook
    book(net.minecraft.resources.ResourceLocation id)
     
     
    static boolean
    isRead(net.minecraft.resources.ResourceLocation book, String entry)
    Whether an entry of a book has been opened by the player (kept between games).
    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.
    static boolean
    open(net.minecraft.resources.ResourceLocation book, String entry)
    Opens a book at an entry ("category/entry", optionally with "#anchor").
    static void
    Lays every book out again at its next drawing, for after something its locks depend on changed.
    static void
    Sets a flag that entries can be locked behind ("flag": "mymod:hard_mode" in their JSON).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • book

      @Nullable public static @Nullable GuideBook book(net.minecraft.resources.ResourceLocation id)
    • books

      public static Collection<GuideBook> 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

      public static boolean open(net.minecraft.resources.ResourceLocation book, String entry)
      Opens a book at an entry ("category/entry", optionally with "#anchor").
      Returns:
      false when there is no such book or entry, or the entry is locked
    • isRead

      public static boolean isRead(net.minecraft.resources.ResourceLocation book, String entry)
      Whether an entry of a book has been opened by the player (kept between games).
    • setFlag

      public static void setFlag(String flag, BooleanSupplier value)
      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; call refresh() 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.