Class FoliosBooks

java.lang.Object
net.ixdarklord.folios.api.FoliosBooks

public final class FoliosBooks extends Object
Guide books from either side: the item that carries one, and opening one for a player from the server.

A book lives in resource packs, at assets/<namespace>/folios/<path>/book.json (id <namespace>:<path>), with its categories and entries beside it; the client reads them and draws them (see net.ixdarklord.folios.api.client.FoliosGuides). The server only knows books by id.

player.addItem(FoliosBooks.createStack(MyMod.id("handbook")));
player.addItem(FoliosBooks.createStack("mymod:handbook"));
player.addItem(FoliosBooks.createStack(MyItems.HANDBOOK.get(), MyMod.id("handbook")));
FoliosBooks.open(player, MyMod.id("handbook"), "basics/first_steps");
In commands: /give @s folios:guide_book[folios:guide_book="mymod:handbook"].
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable net.minecraft.resources.Identifier
    bookOf(net.minecraft.world.item.ItemStack stack)
    The book a stack names: its folios:guide_book component, on any item, or else the book a FoliosBookItem of a mod's own always opens (so its stacks need no component to show their cover); null when none.
    static net.minecraft.world.item.ItemStack
    As createStack(Identifier), the book given as "namespace:path".
    static net.minecraft.world.item.ItemStack
    createStack(net.minecraft.resources.Identifier book)
    Folios's guide book item, opening the given book.
    static net.minecraft.world.item.ItemStack
    createStack(net.minecraft.world.level.ItemLike item, net.minecraft.resources.Identifier book)
    A mod's own item carrying a book in its folios:guide_book component: a FoliosBookItem of its own opens that book and takes its name.
    static void
    open(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier book)
    Opens a book on a player's screen at its first page.
    static void
    open(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier book, @Nullable String entry)
    Opens a book on a player's screen at an entry ("category/entry", its path under the book's entries/), or at its start for null.

    Methods inherited from class Object

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

    • createStack

      public static net.minecraft.world.item.ItemStack createStack(net.minecraft.resources.Identifier book)
      Folios's guide book item, opening the given book.
    • createStack

      public static net.minecraft.world.item.ItemStack createStack(String book)
      As createStack(Identifier), the book given as "namespace:path".
    • createStack

      public static net.minecraft.world.item.ItemStack createStack(net.minecraft.world.level.ItemLike item, net.minecraft.resources.Identifier book)
      A mod's own item carrying a book in its folios:guide_book component: a FoliosBookItem of its own opens that book and takes its name. (On any other item it only names the book, for bookOf(ItemStack).)
    • bookOf

      public static @Nullable net.minecraft.resources.Identifier bookOf(net.minecraft.world.item.ItemStack stack)
      The book a stack names: its folios:guide_book component, on any item, or else the book a FoliosBookItem of a mod's own always opens (so its stacks need no component to show their cover); null when none.
    • open

      public static void open(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier book)
      Opens a book on a player's screen at its first page.
    • open

      public static void open(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier book, @Nullable String entry)
      Opens a book on a player's screen at an entry ("category/entry", its path under the book's entries/), or at its start for null. Does nothing for a client without Folios.