Package net.ixdarklord.folios.api.client
Record Class FoliosBook
java.lang.Object
java.lang.Record
net.ixdarklord.folios.api.client.FoliosBook
- Record Components:
name- raw, as written: a translation key or text (title()reads it)subtitle- raw; empty for nonelanding- raw marked-up text of the book's first pagestyle- how the book is shown:FoliosStyles.SCREEN,FoliosStyles.HANDHELDor one a mod addsaccent- the book's colour, for marks, links and highlights (RGB)cover- the colour of a handheld book's cover (RGB)coverTexture- a texture for a handheld book's cover, drawn over its colour; null for nonemodels- the models it is shown with: the item's, the open book's others see, a handheld book's covershowProgress- whether how much of it has been read is showntilt- how far a handheld book leans back from facing the reader, in degrees (0 faces them squarely)distance- how far a handheld book is held from the reader's eyes, in blockspageTurn- how a handheld book's leaves turnreveal- how a page's content shows once it is turned to ("reveal"; seeFoliosReveal)textures- the layers it is drawn withlayout- where the tabs, turn buttons and page numbers sitclickOutsideCloses- whether a click off the book closes it ("close_on_click_outside"; by default true for a handheld book, false for a screen one)handling- what a reader can do while holding a handheld book open ("handheld")colors- its colour scheme over the style's own: the page's colours and its tooltips' ("colors")coverText- where its name and subtitle are lettered on its cover, and how large ("cover_text")categoryView- how the front of the book lists its categories ("categories")progress- where what is read in it is kept: with each player, or on each copy of the book ("progress")
public record FoliosBook(net.minecraft.resources.ResourceLocation id, String name, String subtitle, String landing, net.minecraft.resources.ResourceLocation style, int accent, int cover, @Nullable net.minecraft.resources.ResourceLocation coverTexture, FoliosIcon icon, FoliosBook.Models models, boolean showProgress, float tilt, float distance, FoliosBook.PageTurn pageTurn, FoliosReveal.Use reveal, FoliosBook.Textures textures, FoliosBook.Layout layout, boolean clickOutsideCloses, FoliosBook.Handling handling, FoliosBook.Colors colors, FoliosBook.CoverText coverText, FoliosBook.CategoryView categoryView, FoliosBook.Progress progress, List<FoliosCategory> categories, Map<String,FoliosEntry> entries, Map<net.minecraft.world.item.Item,FoliosBook.Location> itemIndex)
extends Record
A guide book, as read from
assets/<namespace>/folios/<path>/book.json and the categories and entries beside
it. Books are read again whenever resources reload; don't keep one past that.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordHow the front of the book lists its categories:"categories"in book.json.static final recordA book's colour scheme:"colors"in book.json, each colour"#RRGGBB"(or"#AARRGGBB").static final recordWhere a book's name and subtitle are lettered on its cover, on the book item and a handheld book alike:"cover_text"in book.json.static final recordWhat a reader can do while holding a handheld book open:"handheld"in book.json.static final recordWhere the things around a page's content sit, in page pixels, in both styles:"layout"in book.json.static final recordA place in a book: an entry, a page of it (0 for its first), and an element of that page (0 for its first; -1 for the page as a whole).static final recordThe models a book is shown with:"models"in book.json.static enumHow a handheld book's leaves turn ("page_turn"in book.json).static enumWhere what is read in a book is kept ("progress"in book.json): the entries read, the pages shown, the bookmarks and where the reader left off.static final recordThe texture layers a book is drawn with, in both styles:"textures"in book.json, each a texture path. -
Constructor Summary
ConstructorsConstructorDescriptionFoliosBook(net.minecraft.resources.ResourceLocation id, String name, String subtitle, String landing, net.minecraft.resources.ResourceLocation style, int accent, int cover, @Nullable net.minecraft.resources.ResourceLocation coverTexture, FoliosIcon icon, FoliosBook.Models models, boolean showProgress, float tilt, float distance, FoliosBook.PageTurn pageTurn, FoliosReveal.Use reveal, FoliosBook.Textures textures, FoliosBook.Layout layout, boolean clickOutsideCloses, FoliosBook.Handling handling, FoliosBook.Colors colors, FoliosBook.CoverText coverText, FoliosBook.CategoryView categoryView, FoliosBook.Progress progress, List<FoliosCategory> categories, List<FoliosEntry> entries) FoliosBook(net.minecraft.resources.ResourceLocation id, String name, String subtitle, String landing, net.minecraft.resources.ResourceLocation style, int accent, int cover, @Nullable net.minecraft.resources.ResourceLocation coverTexture, FoliosIcon icon, FoliosBook.Models models, boolean showProgress, float tilt, float distance, FoliosBook.PageTurn pageTurn, FoliosReveal.Use reveal, FoliosBook.Textures textures, FoliosBook.Layout layout, boolean clickOutsideCloses, FoliosBook.Handling handling, FoliosBook.Colors colors, FoliosBook.CoverText coverText, FoliosBook.CategoryView categoryView, FoliosBook.Progress progress, List<FoliosCategory> categories, Map<String, FoliosEntry> entries, Map<net.minecraft.world.item.Item, FoliosBook.Location> itemIndex) Creates an instance of aFoliosBookrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable FoliosBook.Locationabout(net.minecraft.world.item.ItemStack stack) The page about an item, from the items its pages are about; null when none is.intaccent()Returns the value of theaccentrecord component.Returns the value of thecategoriesrecord component.@Nullable FoliosCategoryReturns the value of thecategoryViewrecord component.booleanReturns the value of theclickOutsideClosesrecord component.colors()Returns the value of thecolorsrecord component.intcover()Returns the value of thecoverrecord component.Returns the value of thecoverTextrecord component.@Nullable net.minecraft.resources.ResourceLocationReturns the value of thecoverTexturerecord component.floatdistance()Returns the value of thedistancerecord component.entries()Returns the value of theentriesrecord component.A category's entries the player can see, featured first.@Nullable FoliosEntryfinal booleanIndicates whether some other object is "equal to" this one.handling()Returns the value of thehandlingrecord component.final inthashCode()Returns a hash code value for this object.icon()Returns the value of theiconrecord component.net.minecraft.resources.ResourceLocationid()Returns the value of theidrecord component.Map<net.minecraft.world.item.Item,FoliosBook.Location> Returns the value of theitemIndexrecord component.@Nullable net.minecraft.resources.ResourceLocationThe item model thefolios:guide_bookitem takes for this book; null for its own.landing()Returns the value of thelandingrecord component.layout()Returns the value of thelayoutrecord component.models()Returns the value of themodelsrecord component.name()Returns the value of thenamerecord component.pageTurn()Returns the value of thepageTurnrecord component.progress()Returns the value of theprogressrecord component.reveal()Returns the value of therevealrecord component.booleanReturns the value of theshowProgressrecord component.net.minecraft.resources.ResourceLocationstyle()Returns the value of thestylerecord component.subtitle()Returns the value of thesubtitlerecord component.textures()Returns the value of thetexturesrecord component.floattilt()Returns the value of thetiltrecord component.net.minecraft.network.chat.Componenttitle()final StringtoString()Returns a string representation of this record class.The categories the player can see, in order.
-
Constructor Details
-
FoliosBook
public FoliosBook(net.minecraft.resources.ResourceLocation id, String name, String subtitle, String landing, net.minecraft.resources.ResourceLocation style, int accent, int cover, @Nullable @Nullable net.minecraft.resources.ResourceLocation coverTexture, FoliosIcon icon, FoliosBook.Models models, boolean showProgress, float tilt, float distance, FoliosBook.PageTurn pageTurn, FoliosReveal.Use reveal, FoliosBook.Textures textures, FoliosBook.Layout layout, boolean clickOutsideCloses, FoliosBook.Handling handling, FoliosBook.Colors colors, FoliosBook.CoverText coverText, FoliosBook.CategoryView categoryView, FoliosBook.Progress progress, List<FoliosCategory> categories, List<FoliosEntry> entries) -
FoliosBook
public FoliosBook(net.minecraft.resources.ResourceLocation id, String name, String subtitle, String landing, net.minecraft.resources.ResourceLocation style, int accent, int cover, @Nullable @Nullable net.minecraft.resources.ResourceLocation coverTexture, FoliosIcon icon, FoliosBook.Models models, boolean showProgress, float tilt, float distance, FoliosBook.PageTurn pageTurn, FoliosReveal.Use reveal, FoliosBook.Textures textures, FoliosBook.Layout layout, boolean clickOutsideCloses, FoliosBook.Handling handling, FoliosBook.Colors colors, FoliosBook.CoverText coverText, FoliosBook.CategoryView categoryView, FoliosBook.Progress progress, List<FoliosCategory> categories, Map<String, FoliosEntry> entries, Map<net.minecraft.world.item.Item, FoliosBook.Location> itemIndex) Creates an instance of aFoliosBookrecord class.- Parameters:
id- the value for theidrecord componentname- the value for thenamerecord componentsubtitle- the value for thesubtitlerecord componentlanding- the value for thelandingrecord componentstyle- the value for thestylerecord componentaccent- the value for theaccentrecord componentcover- the value for thecoverrecord componentcoverTexture- the value for thecoverTexturerecord componenticon- the value for theiconrecord componentmodels- the value for themodelsrecord componentshowProgress- the value for theshowProgressrecord componenttilt- the value for thetiltrecord componentdistance- the value for thedistancerecord componentpageTurn- the value for thepageTurnrecord componentreveal- the value for therevealrecord componenttextures- the value for thetexturesrecord componentlayout- the value for thelayoutrecord componentclickOutsideCloses- the value for theclickOutsideClosesrecord componenthandling- the value for thehandlingrecord componentcolors- the value for thecolorsrecord componentcoverText- the value for thecoverTextrecord componentcategoryView- the value for thecategoryViewrecord componentprogress- the value for theprogressrecord componentcategories- the value for thecategoriesrecord componententries- the value for theentriesrecord componentitemIndex- the value for theitemIndexrecord component
-
-
Method Details
-
itemModel
@Nullable public @Nullable net.minecraft.resources.ResourceLocation itemModel()The item model thefolios:guide_bookitem takes for this book; null for its own. -
title
public net.minecraft.network.chat.Component title() -
category
-
entry
-
visibleCategories
The categories the player can see, in order. -
entries
A category's entries the player can see, featured first. -
about
The page about an item, from the items its pages are about; null when none is. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public net.minecraft.resources.ResourceLocation id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
subtitle
Returns the value of thesubtitlerecord component.- Returns:
- the value of the
subtitlerecord component
-
landing
Returns the value of thelandingrecord component.- Returns:
- the value of the
landingrecord component
-
style
public net.minecraft.resources.ResourceLocation style()Returns the value of thestylerecord component.- Returns:
- the value of the
stylerecord component
-
accent
public int accent()Returns the value of theaccentrecord component.- Returns:
- the value of the
accentrecord component
-
cover
public int cover()Returns the value of thecoverrecord component.- Returns:
- the value of the
coverrecord component
-
coverTexture
@Nullable public @Nullable net.minecraft.resources.ResourceLocation coverTexture()Returns the value of thecoverTexturerecord component.- Returns:
- the value of the
coverTexturerecord component
-
icon
Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-
models
Returns the value of themodelsrecord component.- Returns:
- the value of the
modelsrecord component
-
showProgress
public boolean showProgress()Returns the value of theshowProgressrecord component.- Returns:
- the value of the
showProgressrecord component
-
tilt
public float tilt()Returns the value of thetiltrecord component.- Returns:
- the value of the
tiltrecord component
-
distance
public float distance()Returns the value of thedistancerecord component.- Returns:
- the value of the
distancerecord component
-
pageTurn
Returns the value of thepageTurnrecord component.- Returns:
- the value of the
pageTurnrecord component
-
reveal
Returns the value of therevealrecord component.- Returns:
- the value of the
revealrecord component
-
textures
Returns the value of thetexturesrecord component.- Returns:
- the value of the
texturesrecord component
-
layout
Returns the value of thelayoutrecord component.- Returns:
- the value of the
layoutrecord component
-
clickOutsideCloses
public boolean clickOutsideCloses()Returns the value of theclickOutsideClosesrecord component.- Returns:
- the value of the
clickOutsideClosesrecord component
-
handling
Returns the value of thehandlingrecord component.- Returns:
- the value of the
handlingrecord component
-
colors
Returns the value of thecolorsrecord component.- Returns:
- the value of the
colorsrecord component
-
coverText
Returns the value of thecoverTextrecord component.- Returns:
- the value of the
coverTextrecord component
-
categoryView
Returns the value of thecategoryViewrecord component.- Returns:
- the value of the
categoryViewrecord component
-
progress
Returns the value of theprogressrecord component.- Returns:
- the value of the
progressrecord component
-
categories
Returns the value of thecategoriesrecord component.- Returns:
- the value of the
categoriesrecord component
-
entries
Returns the value of theentriesrecord component.- Returns:
- the value of the
entriesrecord component
-
itemIndex
Returns the value of theitemIndexrecord component.- Returns:
- the value of the
itemIndexrecord component
-