Skip to content

Lua API Reference

This section documents the full Wizards of Lua API available to your Lua scripts.

All classes, fields, methods, and events listed here are generated directly from the annotated source files in src/api/lua.


Core

Class Description
Global Functions Built-in functions available without require (log, sleep, str, inspect, declare, instanceOf)
Block A block at a position, including type and block state data
BlockEntity Block entities (chests, furnaces, etc.)
BlockEntityType The type identifier of a block entity
BlockHitResult Raycast hit a block
BlockType The type identifier of a block
DamageSource Origin and cause of damage
Entity Base class for all in-game entities
EntityHitResult Raycast hit an entity
EntityType The type identifier of an entity
EventQueue Queue returned by spell:collect()
EventInterceptor Interceptor returned by spell:intercept()
Filesystem Access to the server's world folder
HitResult Base result of a raycast
Item An item stack
ItemEntity Dropped item entities
ItemType The type identifier of an item
LivingEntity Entities with health, inventory, and equipment
MobEntity AI-controlled mobs
Player Human players
PlayerInventory A player's inventory
Server The Minecraft server instance
Spell The running Lua script itself — access to position, world, events, and commands
Structure NBT structure loading and placement
Trace Captures output from spell:execute()
Vec3 3D vector with arithmetic operators
WizardsOfLua Global mod configuration and dynamic command management
World The Minecraft world — time, dimension, spawn point

Events

Events are received via spell:collect() or intercepted via spell:intercept().

Class Cancelable Description
CustomEvent User-fired custom events via spell:fire()
AfterLivingEntityDamageEvent Entity took damage
AfterLivingEntityDeathEvent Entity died
AfterPlayerBlockBreakEvent Player broke a block
AfterPlayerRespawnEvent Player respawned
BeforeLivingEntityDamageEvent Entity about to take damage
BeforeLivingEntityDeathEvent Entity about to die
BeforePlayerBlockBreakEvent Player about to break a block
ChatMessageEvent Player sent a chat message
ChunkLoadEvent Chunk loaded into memory
ChunkUnloadEvent Chunk unloaded from memory
EntityDespawnEvent Entity removed from world
EntitySpawnEvent Entity added to world
PermissionCheckEvent Permission check for a command
PlayerAttackBlockEvent Player attacked a block
PlayerAttackEntityEvent Player attacked an entity
PlayerChangeWorldEvent Player changed dimension
PlayerDisconnectedEvent Player disconnected
PlayerDropItemEvent Player dropped an item
PlayerDropSelectedItemEvent Player dropped their selected item
PlayerHandSwingEvent Player swung their hand
PlayerJoinedEvent Player joined the server
PlayerUseBlockEvent Player right-clicked a block
PlayerUseEntityEvent Player right-clicked an entity
PlayerUseItemEvent Player used an item