-
Notifications
You must be signed in to change notification settings - Fork 0
Spell Fields
The Spell Field API is a powerful, data-driven engine within EnchantmentCore designed to handle complex Area of Effect (AoE) mechanics, spatial mathematics, and multi-target evaluation.
In standard vanilla Minecraft, enchantment effects are typically restricted to single-target interactions (e.g., Attacker hits Victim). If you want an enchantment to affect everything within a 5-block radius, apply a force based on distance, and render a ring of particles, you would traditionally need to write complex Java logic.
The Spell Field API abstracts this spatial complexity into a declarative JSON structure.
A Spell Field is fundamentally a spatial pipeline. When triggered, it executes the following conceptual steps:
- Geometry Definition: It calculates one or more 3D spatial boundaries (Volumes) around an epicenter.
-
Topology Evaluation: It maps the interior of those volumes using mathematical algorithms (Topologies) to determine a "strength scalar" ranging from
0.0(weakest) to1.0(strongest) for every point in space. - Target Acquisition: It gathers all valid entities and block coordinates within the evaluated geometry.
- Effect Dispatch: It executes configured effects against the gathered targets, feeding the calculated scalar into the effects to dynamically scale damage, duration, or probability based on the target's distance from the epicenter.
To maximize reusability, the Spell Field API is broken down into modular lists of effects:
- Volumes & Topologies: Define the shapes (Cuboids, Spheres) and mathematical falloffs (Linear, Exponential) of the field.
- Entity Effects: Logic executed against every living (or non-living) entity caught within the field.
- Block Effects: Logic executed against block coordinates within the field.
- Volume Effects: Global effects (like Explosions or Lightning) distributed across the spatial geometry.
- Visual Effects: Particle and rendering logic to give your spell field a visual presence.
By combining these components, you can create anything from simple explosive strikes to localized black holes, healing auras, and transient block-transmutation zones.
Want to learn more about the configuration engine powering Enchantment Core?
Check out Config Understood, the official wiki for Config Overhauled, for a deep dive into dynamic property generation and state synchronization!