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:
Colour | Metal |
---|---|
brown | iron |
blue | silver |
green | gold |
red | brass |
purple | copper |
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.
Book Texture JSON Schema
ID | Type | Required | Default | Description |
---|---|---|---|---|
texture | ResourceLocation | ✓ | - | Location of the texture to be used, with .png included. |
width | Integer | ✓ | - | Width of the book background in pixels. |
height | Integer | ✓ | - | Height of the book background in pixels. |
tex_width | Integer | ✓ | - | Full width of the texture file. |
tex_height | Integer | ✓ | - | Full height of the texture file. |
pages | Rectangle[] | ✓ | - | Location and size of the texture's pages. |
title_backer | FixedRectangle | ✓ | - | Location, size and placement of the title backer (e.g the ribbon on default textures). |
left_button | FixedRectangle | ✓ | - | Location, size and placement of the left button. |
right_button | FixedRectangle | ✓ | - | Location, size and placement of the right button. |
back_button | FixedRectangle | ✓ | - | Location, size and placement of the back button. |
refresh_button | FixedRectangle | ✓ | - | Location, size and placement of the refresh button. |
widgets | Map<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:
ID | Description |
---|---|
separator | Separator used for the modopedia:separator PageComponent. |
large_frame | Frame used for the modopedia:large_frame PageComponent. |
medium_frame | Frame used for the modopedia:medium_frame PageComponent. |
small_frame | Frame used for the modopedia:small_frame PageComponent. |
crafting_grid | Grid used for the modopedia:crafting_grid PageComponent. |
crafting_arrow | Arrow used for the modopedia:crafting_arrow PageComponent. |
crafting_flame | Flame 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.
ID | Type | Required | Default | Description |
---|---|---|---|---|
u | Integer | ✓ | - | X location of the rectangle on the texture. |
v | Integer | ✓ | - | Y location of the rectangle on the texture. |
width | Integer | ✓ | - | Width of the rectangle. |
height | Integer | ✓ | - | 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.
ID | Type | Required | Default | Description |
---|---|---|---|---|
x | Integer | ✓ | - | X location the widget should be displayed at on the Screen. |
y | Integer | ✓ | - | Y location the widget should be displayed at on the Screen. |
u | Integer | ✓ | - | X location of the widget on the texture. |
v | Integer | ✓ | - | Y location of the widget on the texture. |
width | Integer | ✓ | - | Width of the widget in pixels. |
height | Integer | ✓ | - | 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 }}}