Skip to content

Template / Other Sub-Editors

Belongs to: Editor GUI · Related: Fragments & Templates · Resource Pack

This page summarizes the remaining sub-editors under the item editor: the Template Hub, Resource Pack / Models, and the editor's session / save mechanism.


1. Template Hub (TemplateHubGui)

Entered via [Template] in the item editor. Multiple tabs at the top: Definition / Skills / Abilities / Resource Pack / Type Info / Library.

Definition Tab

  • Lore / Fragments (FragmentSelectionGui + LoreBlockGui):
    • Paged management of referenced fragment IDs.
    • Add / edit / delete Lore lines (chat input).
  • Variables (VariableDeclarationGui):
    • Paged management of variable entries (key=value).
    • Add: enter key → enter value.
    • Shift + right-click to edit value; right-click to delete.

Skills Tab

Shows the action table + trigger count + skill binding overview. Lets you jump to the Action / Skill editor.

Abilities Tab

Lists the item's ability modules (skill / attribute / render / set…); click to view entries.

Resource Pack Tab

Jumps to the Resource Pack Hub (see below).

🖼️ [Image placeholder] The Definition tab of the Template Hub (fragments + variables) · suggested assets/editor-template.png


2. Resource Pack / Model Hub (ResourcePackHubGui)

Edits the item's custom model.

  • CMD Editor (CMDEditorGui): sets custom_model_data.
  • Model Selector (ModelSelectorGui): pick a model from a category in the model catalog in integrations/resource_models.yml.

Note: QI applies strict isolation validation to resource pack fields — models cannot bind variables / layers / conditions.


3. Section / Affix Compile (SectionAffixCompileGui)

Used to view / compile Sections and affixes.


4. Content Pack Editing (ItemPackEditorGui)

Opened with /qi packs gui; manages export / import / sync of .qipack content packs. See Import & Export for the import/export mechanism.


5. Session & State (EditorSession)

The editor maintains one EditorSession per player, recording:

  • mode: the current state-machine mode (80+ kinds, deciding which listener consumes the next chat message).
  • workingCopy: the item definition being edited (in-memory working copy).
  • Drafts of each sub-editor (current trigger, action draft, set profile index, variable key, attribute key-value…).

EditorSessions.isAwaitingChat(player) determines whether the player is in the "awaiting chat input" state. Closing the inventory without saving = discard the working copy.


6. Save Guard (EditorSaveGuard)

Save flow:

saveItemOrNotify(player, definition)
1. PolicyEngine.validateItem(definition) validation (constraint checks, not just schema)
2. On error → show error in chat, refuse to save
   On warning → show in chat, continue
3. QinhItemRegistry.save() writes back to sourceFile
4. ActionTableRegistry.reload() hot-reloads the action table
5. Success message + anvil sound effect

For validation rules (errors you may run into), see Resource Pack → Validation Constraints.


7. Chat Input System (EditorChatInput)

Many fields, when clicked, close the inventory and prompt for input in the chat box. Unified prompt format:

─────────────────
[QinhItems Editor] <title>
<prompt line 1>
<prompt line 2>
Enter cancel to cancel
─────────────────

EditorChatListener intercepts the next message: entering cancel cancels and returns to the previous screen; otherwise it processes the input according to the current mode, updates the session, and re-renders the screen.


Next Steps