Skip to content
riddle edited this page Sep 7, 2014 · 1 revision

Spells are custom actions happening when special book items are right clicked.

Currently there are 8 active spells and 1 deprecated one.

  • Decay
  • Forging
  • Fusing
  • Growth
  • Peddling
  • Time
  • Unsliming
  • Deadweight (deprecated)
  • Wind

Command

To spawn spells:

/mantle makebook <spell>

For example to make a spell of time, /mantle makebook time.

You can provide an optional parameter specifying how many spells you want to create.

/mantle makebook <spell> <count>

Example: /mantle makebook unsliming 10

NBT template

Spells are saved in Mantle/nanobot/ directory, in spell-<name>.yml files. They are not automatically created when plugin is first loaded.

General template looks like this:

display:
  compound:
    Name: "&6Spell of Decay"
    Lore:
    - "&6Nature shrivels and dies around you."
    - "&7Decays leaves, mushrooms, flowers and grass."
    - "&7Turns grass into dirt when stood upon."
    - "&7Removes the dye from wool in inventory."
    - "&8Right click to decay 32x32x32 area around you."
    - "&8Right click a chest to change the wool inside."
    - "ExpireAfterDays: 14"

The only immutable part of this template is Name – without it, Mantle isn’t aware that the book is a spell.

The last line of Lore tag is a way to add expiration date to spells. Spell is going to be generated with a timestamp tag and Mantle will check it when trying to cast a spell.

Dynamic interface

Spell item uses ProtocolLib to apply two dynamic changes to how the item is presented:

  1. Enchantment shine – book itself doesn’t have any enchantments, the shine effect is applied dynamically.
  2. Relative timestamp – book’s actual label has a fixed timestamp which is dynamically edited into a relative date (Expires in 13 days)

Clone this wiki locally