### Example Landing Callback for Entity Spawning
Source: https://github.com/magmaguy/elitemobs/blob/master/docs/lua-scripts.md
Landing callbacks for spawned entities receive the landing location and the spawned entity, allowing for further actions like spawning particles.
```lua
function(landing_location, spawned_entity)
context.world:spawn_particle_at_location(landing_location, "EXPLOSION", 1)
end
```
--------------------------------
### Example Lua Power File Structure
Source: https://github.com/magmaguy/elitemobs/blob/master/docs/lua-scripts.md
A typical Lua power file must return a flat table defining its behavior, including API version, priority, and event hooks.
```lua
return {
api_version = 1,
priority = 0,
on_spawn = function(context)
context.boss:add_tag("awake")
end,
on_boss_damaged_by_player = function(context)
if context.cooldowns.local_ready("shield") then
context.event.multiply_damage_amount(0.5)
context.cooldowns.set_local(60, "shield")
end
end
}
```
--------------------------------
### Direct Scripting Helpers for Targeting and Damage
Source: https://github.com/magmaguy/elitemobs/blob/master/docs/lua-scripts.md
Utilize context.script helpers for defining zones, targeting entities within those zones, and applying damage.
```lua
local zone = context.script:zone({
type = "sphere",
radius = 4
})
local targets = zone:full_target()
context.script:damage(targets, 2.0, 1.0)
```
--------------------------------
### Gradle Repository and Dependency for EliteMobs
Source: https://github.com/magmaguy/elitemobs/blob/master/README.md
Configure your Gradle project to use the MagmaGuy repository and include the EliteMobs dependency.
```kotlin
repositories {
//EliteMobs
maven {
url = uri("https://repo.magmaguy.com/releases")
}
}
dependencies{
//EliteMobs
compileOnly("com.magmaguy:EliteMobs:9.1.9")
}
```
--------------------------------
### Maven Repository and Dependency for EliteMobs
Source: https://github.com/magmaguy/elitemobs/blob/master/README.md
Add the MagmaGuy repository and the EliteMobs dependency to your Maven project.
```xml
magmaguy-repo-releases
MagmaGuy's Repository
https://repo.magmaguy.com/releases
com.magmaguy
EliteMobs
9.1.9
```
--------------------------------
### API Events
Source: https://github.com/magmaguy/elitemobs/blob/master/README.md
EliteMobs provides several API events that allow developers to hook into various in-game occurrences related to custom mobs, arenas, dungeons, and more. These events can be used to trigger custom logic or modify existing behaviors.
```APIDOC
## API Events
EliteMobs has a few basic APIs to interface with in the `com.magmaguy.elitemobs.api` package. Here's the breakdown:
### ArenaCompleteEvent
Fires when an arena is successfully beaten by players.
### CustomEventStartEvent
Fires when a Custom Event starts. Note that in this instance Custom Events refers to the mechanic in which bosses randomly spawn in the Overworld.
- Can be cancelled
### DungeonInstallEvent
Fires when a dungeon is installed by an admin.
- Can be cancelled
### DungeonUninstallEvent
Fires when a dungeon is uninstalled by an admin.
- Can be cancelled
### EliteExplosionEvent
Fires when an Elite Explosion happens. Note that elite explosions have a custom visual effect and regenerate the damage done to terrain after 2 minutes.
- Can be cancelled
### EliteMobDamagedByEliteMobEvent
Used for listening to moments when one Elite damages another Elite. Uses:
- Same as Bukkit's EntityDamagedByEntity event but for elites specifically
- Cancelling it might not work. Report if it doesn't.
### EliteMobDamagedByPlayerAntiExploitEvent
Used for listening to events which trigger an antiexploit **check** - doesn't necessarily mean that it detected an exploit. Uses:
- Same as Bukkit's EntityDamagedByEntity event but for elites specifically
- Can be cancelled
### EliteMobDamagedByPlayerEvent
Used for listening to moments when a player damages an Elite. Uses:
- Same as Bukkit's EntityDamagedByEntity event but for players damaging elites specifically
- ***Important:*** can't be cancelled as it only fires after applying the damage
### EliteMobDamagedEvent
Used for listening to moments when an elite is damaged in general. Uses:
- Same as Bukkit's EntityDamageEvent
- ***Important*** Cancelling this event might not 100% work, report if it doesn't
### EliteMobDeathEvent
Used to listening to moments when an elite is killed. Uses:
- Same as Bukkit's EntityDeathEvent.
### EliteMobEnterCombatEvent
Used for listening to moments when an elite enters combat against a player. Note that bosses only enter combat after either striking a player or being struck, and not at the moment of targetting. Uses:
- Get the target (player only) of the Elite
- Get the elite which entered in combat
### EliteMobExitCombatEvent
Used for listening to moments when an elite leaves combat against a player. Uses:
- Get the elite which just let combat.
### EliteMobHealEvent
Used when an elite gets healed.
- Can be cancelled.
### EliteMobRemoveEvent
Used when an elite mob gets removed. Please note that not all removals are permanent as bosses can be removed because the chunks unload while still being persistent.
### EliteMobsItemDetector
Used for detecting whether an ItemStack is an EliteMobs ItemStack (like a custom item or a procedurally generated item). Uses:
- Detect if an ItemStack is an EliteMobs custom or dynamic item.
### EliteMobSpawnEvent
Used for detecting when an Elite spawns. Uses:
- Detect when an Elite spawns.
- Detect which Elite spawned.
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.