Skip to content
David Quintana edited this page Feb 14, 2023 · 1 revision

Guidebook offers a template system, that allows declaring a pattern that can be repeated multiple times.

This pattern can include any standard book tag, along with 'element' tags. These tags will be replaced by a corresponding input element, when the template is used, but the attributes (other than 'index') will transfer over to the result.

<template id="big_recipe" height="64">
  <image src="gbook:crafting_grid" />
  
  <element index="0" x="3" y="3" />
  <element index="1" x="22" y="3" />
  <element index="2" x="41" y="3" />
  <element index="3" x="3" y="22" />
  <element index="4" x="22" y="22" />
  <element index="5" x="41" y="22" />
  <element index="6" x="3" y="41" />
  <element index="7" x="22" y="41" />
  <element index="8" x="41" y="41" />
  <element index="9" x="79" y="22" />
</template>

Template libraries

On top of that, templates can be defined inside template library files, and those files can be included from books.

<library>
  <template id="big_recipe" height="64">
    ...
  </template>
</library>

Recipes

For now, the only way to show recipes is to declare them using the template system.

<big_recipe>
  <stack item="minecraft:stained_glass" meta="0" />
  <stack item="minecraft:stained_glass" meta="1" />
  <stack item="minecraft:stained_glass" meta="2" />
  <stack item="minecraft:stained_glass" meta="3" />
  <stack item="minecraft:stained_glass" meta="4" />
  <stack item="minecraft:stained_glass" meta="5" />
  <stack item="minecraft:stained_glass" meta="6" />
  <stack item="minecraft:stained_glass" meta="7" />
  <stack item="minecraft:stained_glass" meta="8" />
  <stack item="minecraft:stained_glass" meta="9" />
</big_recipe>

Result of the example

In the future, I want to add a system to query and show recipes, but this is not implemented yet.