API

Spellbook Plus provides a developer API for creating custom spells and integrations.

Service Registry

Access services globally via ServiceRegistry:

SpellbookConfig config = ServiceRegistry.get(SpellbookConfig.class);
CooldownManager cooldowns = ServiceRegistry.get(CooldownManager.class);
ManaManager mana = ServiceRegistry.get(ManaManager.class);
SpellHotbarManager hotbar = ServiceRegistry.get(SpellHotbarManager.class);
SpellCastHandler castHandler = ServiceRegistry.get(SpellCastHandler.class);
NodeRegistry nodes = ServiceRegistry.get(NodeRegistry.class);

Interfaces

IManaManager

Manage player mana resources.

public interface IManaManager {
    boolean hasMana(UUID playerId, int amount);
    boolean consumeMana(UUID playerId, int amount);
    void addMana(UUID playerId, int amount);
    void setMana(UUID playerId, int amount);
    void setMaxMana(UUID playerId, int maxMana);
    int getCurrentMana(UUID playerId);
    int getMaxMana(UUID playerId);
    int calculateManaCost(String spellId);
    void removePlayer(UUID playerId);
}

ICooldownManager

Manage spell cooldowns.

ISpellExecutor

Execute spell graphs.

ISpellValidator

Validate spell definitions.

ISpellStorage

Store and retrieve player spells.

Spell Definition Schema

SpellDefinition

SpellGraph

SpellNode

NodeConnection

Node Types

Trigger Nodes

Type
Description

on_cast

Spell initiation trigger

on_hit

Projectile hit trigger

on_expire

Spell end trigger

Action Nodes

Type
Description

damage

Apply damage to targets

heal

Heal target

spawn_projectile

Create projectiles

apply_effect

Apply status effects

push

Knockback effect

shield

Absorption shield

teleport

Movement/blink

conditional

If/then branching

Creating Custom Nodes

Extend SpellNodeHandler:

Register in NodeRegistry:

TriggerContext

Context passed during spell execution:

Cast Results

CastResult

CastFailureReason

Validation

ValidationResult

Whitelists

Projectile Types

Effect Types

Damage Types

Events

Hytale Events

The mod listens to these Hytale events:

Event
Purpose

PlayerMouseButtonEvent

Spell staff interactions

AddPlayerToWorldEvent

Initialize player components

PlayerDisconnectEvent

Cleanup player data

Components

ECS-style components for entities:

Component
Purpose

ManaComponent

Player mana tracking

CooldownComponent

Per-spell cooldowns

SpellHotbarComponent

Selected spells

SpellLifetimeComponent

Projectile lifetime

ProjectileDataComponent

Projectile metadata

Network Packets

EffectPacket

Sends visual effects to clients:

Example: Custom Spell Handler

Last updated