Entries
Entries are defined in json files placed in the /data/<mod_id>/modonomicon/books/<book_id>/entries/<category_id>/ folder.
Attributes
category (ResourceLocation, mandatory)
The ResourceLocation of the category this entry should be placed in.
The file hierarchy of the entry's json file does not actually assign the entry to the category, only this field does!
name (DescriptionId, mandatory)
The entry name, will be shown in bold when hovering over the Entry. Will not parse markdown.
description (DescriptionId, optional)
The entry description, will be shown below the name when hovering over the Entry. Will not parse markdown.
icon (ResourceLocation, mandatory)
Either an item/block ResourceLocation that should be used as icon. E.g.: minecraft:nether_star or minecraft:chest.
Or the ResourceLocation to a texture. The texture must be 16x16 pixels. E.g.: modonomicon:textures/gui/some_random_icon.png.
To use a texture make sure the ResourceLocation includes the file endinge .png as seen in the example above.
x (Integer, mandatory)
The x coordinate (horizontal) of the entry in the category.
y (Integer, mandatory)
The y coordinate (vertical) of the entry in the category.
sort_number (Integer, optional)
Defaults to -1.
If the category of this entry is in "index" mode, then the sort number will be used to order the entries (instead of using x/y to place the entry on the 2d node grid).
When using datagen and no sort nubmer is provided, the CategorProvider will automatically assign a sort number based on the order the entries are added when using .add().
hide_while_locked (Boolean, optional)
Default value: false. If true, this entry will not be shown as greyed out while it is locked, instead it will be entirely hidden.
Usually the default value is what you want. Regardless of this setting, locked entries will be hidden fully until the entry just before them (= the immediate parent) becomes unlocked, and only then show greyed out. true will cause the entry to stay hidden even then.
show_when_any_parent_unlocked (Boolean, optional)
Default value: false.
If true, the entry will show (locked) as soon as any one parent is unlocked.
If false, the entry will only show (locked) as soon as all parents are unlocked.
If you want this true or false depends on how "discoverable" you want your book to be. If true the entry will be visible to the player earlier, and the tooltip will indicate that they will need another entry to unlock it.
If false the entry will only show once all parents of it are unlocked, effectively making the player aware much later.
background_u_index (Integer, optional)
Default value: 0. Use this to select a different entry background from the entry_textures texture configured in the Category. u represents the Y Axis (vertical). The index is zero-based, so the first entry background is 0, the second is 1, etc.
background_v_index (Integer, optional)
Default value: 0. Use this to select a different entry background from the entry_textures texture configured in the Category. v represents the X Axis (horizontal). The index is zero-based, so the first entry background is 0, the second is 1, etc.
condition (Condition, optional)
Entries, like Categories, can be hidden until an Unlock Condition is fulfilled. Conditions are JSON objects.
See Unlock Conditions for details.
parents (Parent[], optional)
Entry Parents are JSON Objects that define Entries this Entry should be connected to. See Parents for details.
A parent connection does not imply an unlock condition or any logical dependency, by default it is just a visual connection, however it can be used to automatically define unlock conditions. See auto_add_read_conditions in Book.json.
pages (Page[], optional)
Pages are JSON Objects that define the actual book content. See Page Types for the available types of pages.
File-based Pages
In addition to inline pages, single pages can be provided as separate JSON files. This allows datapacks (and mods) to override, add or remove individual pages without copying the entire entry JSON.
File structure:
Page files live in a pages/ directory that mirrors the entry path:
data/<mod_id>/modonomicon/books/<book_id>/pages/
<category_id>/
<entry_name>/
<any_name>.json ← single page file, the file name is informational only
For example, a page file at data/modonomicon/modonomicon/books/demo/pages/features/file_pages/override_by_id.json belongs to entry modonomicon:features/file_pages.
Each page file contains a single page JSON object. To override an existing inline page, the file targets it — with an id, an anchor or an index; without a target the file adds a new page:
{
"id": "intro",
"type": "modonomicon:text",
"title": "book.mymod.demo.features.myentry.intro.title",
"text": "book.mymod.demo.features.myentry.intro.text"
}
Targeting rules (checked in this order: id, then anchor, then index):
id(String, optional): replaces the inline page with the sameid. If no inline page has thisid, the file is appended as a new page — theiddoubles as the new page's identity. Inline pages only have anidif the author set one (via datagen:withId(...)).anchor(String, optional): replaces the first inline page with the same (non-empty)anchor. Errors if nothing matches.index(Integer, optional): replaces the inline page at this 0-based position. Errors if out of range.- No target: the page is appended at the end of the entry. Multiple appended pages are ordered by their optional
sort_number(default: last).
Replacements keep the inline page's position; index and sort_number are merge-time only and are stripped from the page. Files are processed in file-path order. Targeting a page that does not exist is reported as an error and the file is skipped.
To remove an inline page, give the file-based page a target and a failing load_condition, e.g. {"type": "modonomicon:false"}. Only the target and the load condition are needed:
{
"id": "obsolete_page",
"load_condition": {
"type": "modonomicon:false"
}
}
Live samples that override, add and remove pages of the demo book entry modonomicon:features/file_pages:
demo page files on GitHub
category_to_open (ResourceLocation, optional)
The resource location to the category that should be opened when this entry is clicked. If this is set, the entry will never show it's pages, but instead open the category directly.
This allows to create "sub-category" that does not show up in the category navigation menu, if combined with "show_category_button" : false setting for the target category. See also Categories.
command_to_run_on_first_read (ResourceLocation, optional)
The resource location to the command that should be opened when this entry is read/opened for the first time. See Commands on how to create the command.
This can be used to e.g. give rewards to players for reaching a certain part of the book.
entry_to_open (ResourceLocation, optional)
The resource location to the entry that should be opened when this entry is clicked. This allows to place one entry in multiple categories by referring to it multiple times. If this is set, the entry will never show it's pages, but instead open the target entry.
Parents
Entry Parents define which entry comes visually before this entry in the book, as in, which entry points an arrow at this entry.
Attributes
entry (ResourceLocation, mandatory)
The ResourceLocation of the parent entry. This is the main attribute.
draw_arrow (Boolean, optional)
Default value: true. If false, the line connecting parent and this entry will not have an arrow at the end.
line_enabled (Boolean, optional)
Default value: true. If false, there will be no connecting line. This is useful if you want to use the parent connection to define an automatic unlock condition, but don't want to show the line.
line_reversed (Boolean, optional)
Default value: false.
If true, the line will be drawn in reverse, which means the curve is mirrored. This allows you to determine if the curve goes left or right / up or down to get nice symmetrical graphs.
This has no effect on straight lines.
This does not affect the direction of the arrow.
Usage Examples
{
"name": "multiblock",
"description": "modonomicon.test.entries.test_category.multiblock.description",
"icon": "minecraft:chest",
"x": 6,
"y": 2,
"category": "modonomicon:test_category",
"pages": [
{
"type": "modonomicon:text",
...
},
{
"type": "modonomicon:multiblock",
...
}
],
"parents": [
{
"entry": "modonomicon:test_category/test_entry"
}
]
}