Modopedia

Book Textures

A Book Texture is not just a texture-- it also contains metadata about a texture such as its file path, dimensions, the size of the texture and position of various widgets. The versatility of this feature is one of the biggest things making Modopedia stand out from other guidebook mods.

Book Textures should be located in a resource pack at assets/<namespace>/modopedia/book_textures/<book_texture>.json where namespace is the ID of your mod or namespace of your modpack, and book_texture is the ID of your texture. Both of these need to follow Minecraft's ResourceLocation rules. When using your BookTexture, the ID you should provide is namespace:book_texture.

Built-in Textures

Modopedia provides 25 built-in textures free for everybody to use, but I highly recommend adding your own if you have the resources to do so. It helps your project stand out amongst others, and Modopedia provides as many tools as it can to help you with this.

The default textures are all a combination of a colour (the colour of the binding) and a metal (the type of metal used for the braces) in the format modopedia:<colour>_<metal>, for example modopedia:brown_brass (the default). The following colours and metals are available:

ColourMetal
browniron
bluesilver
greengold
redbrass
purplecopper

Pages

Every Book Texture contains Pages, which are the rectangles a book's content gets displayed in. You need at least one page, but there are no limits to how many you can have and the built-in Book Types should format themselves to fit the number of pages your texture has.

modopedia:book_textures/page_explanation

Book Texture JSON Schema

IDTypeRequiredDefaultDescription
textureResourceLocation-Location of the texture to be used, with .png included.
widthInteger-Width of the book background in pixels.
heightInteger-Height of the book background in pixels.
tex_widthInteger-Full width of the texture file.
tex_heightInteger-Full height of the texture file.
pagesRectangle[]-Location and size of the texture's pages.
title_backerFixedRectangle-Location, size and placement of the title backer (e.g the ribbon on default textures).
left_buttonFixedRectangle-Location, size and placement of the left button.
right_buttonFixedRectangle-Location, size and placement of the right button.
back_buttonFixedRectangle-Location, size and placement of the back button.
refresh_buttonFixedRectangle-Location, size and placement of the refresh button.
widgetsMap<String, Rectangle>-Location, size and placement of all dynamic widgets (e.g separator, frames, etc)

Widgets

Textures contains a number of widgets used for the built-in components and templates. While recommended, these are not strictly necessary. You can omit them from the texture if your book doesn't contain those elements. Some of the templates will attempt to work around it (e.g. by removing the separator from a text page), while others will error (e.g. a shaped recipe template with no crafting grid). These are the "default" widgets:

IDDescription
separatorSeparator used for the modopedia:separator PageComponent.
large_frameFrame used for the modopedia:large_frame PageComponent.
medium_frameFrame used for the modopedia:medium_frame PageComponent.
small_frameFrame used for the modopedia:small_frame PageComponent.
crafting_gridGrid used for the modopedia:crafting_grid PageComponent.
crafting_arrowArrow used for the modopedia:crafting_arrow PageComponent.
crafting_flameFlame used for the modopedia:crafting_flame PageComponent.

Rectangle JSON Schema

Rectangle is an object used to describe the location and size of a rectangle on a book's texture. Most notably, it's used for pages.

IDTypeRequiredDefaultDescription
uInteger-X location of the rectangle on the texture.
vInteger-Y location of the rectangle on the texture.
widthInteger-Width of the rectangle.
heightInteger-Height of the rectangle.

FixedRectangle JSON Schema

FixedRectangle, similarly to Rectangle, defines the location and size of a rectangle on the texture, but it also defines an X and Y position it will be placed at. Most notably, it's used for fixed widgets like the navigation buttons.

IDTypeRequiredDefaultDescription
xInteger-X location the widget should be displayed at on the Screen.
yInteger-Y location the widget should be displayed at on the Screen.
uInteger-X location of the widget on the texture.
vInteger-Y location of the widget on the texture.
widthInteger-Width of the widget in pixels.
heightInteger-Height of the widget in pixels.

Example BookTexture JSON

Here's one of the built-in book textures provided by Modopedia as an example of how to write one of these JSON files.

{
"texture": "modopedia:textures/gui/books/brown_brass.png",
"width": 290,
"height": 182,
"tex_width": 290,
"tex_height": 310,
"pages": [
{ "u": 33, "v": 16, "width": 100, "height": 150 },
{ "u": 157, "v": 16, "width": 100, "height": 150 }
],
"title_backer": { "x": 0, "y": 12, "u": 0, "v": 213, "width": 140, "height": 35 },
"left_button": { "x": 0, "y": 183, "u": 0, "v": 183, "width": 18, "height": 10 },
"right_button": { "x": 272, "y": 183, "u": 19, "v": 183, "width": 18, "height": 10 },
"back_button": { "x": 136, "y": 183, "u": 54, "v": 183, "width": 18, "height": 11 },
"refresh_button": { "x": 26, "y": 159, "u": 38, "v": 183, "width": 15, "height": 14 },
"widgets": {
"separator": { "u": 0, "v": 249, "width": 100, "height": 6 },
"small_frame": { "u": 54, "v": 255, "width": 20, "height": 20 },
"medium_frame": { "u": 0, "v": 255, "width": 54, "height": 54 },
"large_frame": { "u": 140, "v": 182, "width": 104, "height": 104 },
"crafting_grid": { "u": 74, "v": 255, "width": 54, "height": 54 },
"crafting_arrow": { "u": 73, "v": 183, "width": 16, "height": 13 }
}
}