# rpg_lore generated docs v3
=== RPG Lore — Book Definition Format ===

Each .json file in this folder (and in datapacks at data/<namespace>/rpg_lore/books/)
defines one lore book. A book is a JSON object with the following fields.

--- Format and Identification ---

format_version       (int)     Optional. Only version 1 is supported; omit this field or set it to 1.
                               Any other value is an error and the book will not load.
                               Default: 1 (when omitted)

id                   (string)  Optional. The book's internal ID (resource location format).
                               If omitted, the ID is derived from the config filename or datapack resource path.
                               Default: rpg_lore:<filename> (config) or <namespace>:<path> (datapack)

--- Required Fields ---

title                (string)  Book title displayed in-game and on the title page. Required.
                               Titles longer than 48 characters produce a warning.
pages                (array)   List of page content. Each page is either a plain string (auto-wrapped)
                               or a JSON text component for formatting and interaction. Required.
                               Capped at 200 pages; extra pages are truncated.
                               See docs/INTERACTIVE_TEXT.md for hover events and click features.

--- Optional Content Fields ---

author               (string)  Author name shown in the tooltip and on the title page.
                               Default: "Unknown"

generation           (int)     Book wear level: 0 = Original, 1 = Copy, 2 = Copy of Copy, 3 = Tattered.
                               Clamped to 0-3 with a warning if out of range.
                               Default: 0

weight               (number)  Selection weight when multiple books match a drop condition. Higher = more likely.
                               Clamped to minimum 0.01 if set to 0 or negative.
                               Default: 1.0

--- Appearance Fields (all optional) ---

title_color          (string)  Hex color for the title (e.g., "FFD700" for gold).
                               Default: "FFFF55" (yellow)

author_color         (string)  Hex color for the author name.
                               Default: "AAAAAA" (gray)

description          (string)  Brief description shown in the tooltip.
                               Default: (none)

description_color    (string)  Hex color for the description text.
                               Default: "55FFFF" (aqua)

hide_generation      (bool)    If true, hides the generation label in the tooltip.
                               Default: false

show_glint           (bool)    If true, the book has an enchantment glint effect.
                               Default: true

category             (string)  Optional category for grouping books in the Codex (e.g., "History").
                               Default: (none, book is uncategorized)

codex_exclude        (bool)    If true, this book does not appear in the Lore Codex.
                               Default: false

--- Drop Conditions (all optional, nested in "drop_conditions" object) ---

Omitted fields match everything. The object itself is optional.

require_player_kill  (bool)    Must the mob be killed by a player?
                               Default: true

base_chance          (number)  Override the global drop chance (0.0 to 1.0) for this book.
                               Default: (global setting)

max_copies_per_player (int)    Maximum times a player can receive this book; -1 = unlimited.
                               Default: -1

mob_types            (array)   Entity type IDs, e.g., ["minecraft:zombie"].
mob_tags             (array)   Entity type tags, e.g., ["minecraft:undead"].
biomes               (array)   Biome IDs, e.g., ["minecraft:plains"].
biome_tags           (array)   Biome tags, e.g., ["minecraft:is_overworld"].
dimensions           (array)   Dimension IDs, e.g., ["minecraft:overworld"].
min_y / max_y        (int)     Y-coordinate range for the kill location.
time                 (string)  "ANY", "DAY_ONLY", or "NIGHT_ONLY". Default: "ANY"
weather              (string)  "ANY", "CLEAR_ONLY", "RAIN_ONLY", or "THUNDER_ONLY". Default: "ANY"

All array fields default to matching everything if omitted.

--- Acquisition (optional "acquisition" array, additive) ---

Each entry is an object with a required "type". drop_conditions above still works and
becomes one entity_drop rule; a book with neither gets a default entity_drop rule.

type "entity_drop"   Same keys as drop_conditions, plus "chance" as an alias of base_chance
                     (if both are given, chance wins and a warning is logged).
type "loot_table"    loot_tables (array of loot table IDs, required, e.g. ["minecraft:chests/simple_dungeon"])
                     chance (0.0 to 1.0, default 1.0), weight (> 0, default 1.0).
                     Entity tables are ignored here; mob drops stay with entity_drop.
type "advancement"   advancements (array of advancement IDs, required, e.g. ["minecraft:story/root"])
                     delivery: "codex" (default) adds the book to the Codex,
                     "inventory" gives a physical book once.

--- Codex Metadata Fields (all optional, top level) ---

tags                 (array)   Searchable keywords, e.g. ["ruins", "war"]. Blank entries are dropped.
discovery_hint       (string)  Hint shown on uncollected Codex entries (server config can disable hints).
series               (string)  Series name shown in the Codex tooltip.
series_order         (int)     Position within the series; negative values clamp to 0. Default: 0

--- General Notes ---

Unknown fields at the top level or in drop_conditions produce a warning and are ignored.
Fields prefixed with _ or containing : are reserved for extension namespaces.

Page text must be valid JSON (strict parsing enforced). Plain strings are auto-wrapped in JSON text
components. See docs/INTERACTIVE_TEXT.md for hover events, click events, and other interactive
features supported in page text.

Datapacks can also define books: place a .json file at data/<namespace>/rpg_lore/books/<path>.json.
The default ID is <namespace>:<path>, unless the JSON declares an id field.
Config definitions override datapack definitions with the same ID; every override is logged at INFO level.

Use /rpglore validate or /rpglore validate <book_id> to validate without reloading.
Use /rpglore reload to rescan only the config folder (datapack books require /reload).

--- Example ---

{
  "title": "The Ancient Battle",
  "author": "Unknown Chronicler",
  "generation": 0,
  "weight": 5,
  "title_color": "FFD700",
  "description": "A faded account of a great battle fought long ago.",
  "category": "History",
  "drop_conditions": {
    "mob_types": ["minecraft:zombie", "minecraft:skeleton"],
    "biome_tags": ["minecraft:is_overworld"],
    "time": "NIGHT_ONLY"
  },
  "pages": [
    "{\"text\":\"Long ago, in these very fields...\"}",
    "{\"text\":\"The battle raged for three days...\"}"
  ]
}
