Magic

Provides a framework to build tools that allow triggering arbitrary effects

Requirements

Contents

Items:

item loot table
ticket Ticket magic:ticket
wand Wand magic:wand
bauble Bauble magic:bauble
spell Spell magic:spell
grimoire Grimoire magic:book

Advancements:

title description
grimoire Bound Pages and Spells bind at least one item in a Grimoire

Usage

There are five special items provided by the datapack:

Ticket

Wand

Bauble

The effect triggered by the bauble Bauble can be changed by dropping it alongside a ticket Ticket or wand Wand; the second item will be destroyed and the effect will be copied, overwriting any previous effects it may have had.

Spell

This is a magic as a service provided by a villager trader; the item triggers instantly the moment that you buy it. It will not trigger by itself any other way, but it could technically be bound into a grimoire Grimoire.

Grimoire

The grimoire Grimoire can be edited by dropping it on a double chest; by doing so the Grimoire's and chest's inventories will be swapped. any ticket Tickets, wand Wands, and bauble Baubles bound to the Grimoire will then appear in its first six pages, and they can be used by clicking on their names.

ticket Tickets and bauble Baubles bound into a Grimoire will not break when used.

Overhead

Checks every player every frame to see if they used a carrot on a stick

Checks every player every frame to see if they have been hurt while carrying a bauble.

Checks every item in a 4-block distance of every player every second to see if it is a book that should be updated

Known Issues

Any magic item that replaces the held tool when cast should either have a safety check in the called function or it will destroy the book being held by the player.

When triggering any book slot, the datapack will check in order the player maihand, the player offhand, and finally raycast in search of a lectern, and trigger the magic from the first book it finds, regardless of the one the player actually used.