Lua-API-Referenz
Vollständige Methodenreferenz für die Lua-Scripting-API. Alle Methoden werden über die Syntax context.table:method() aufgerufen.
Globale Methoden (markiert mit GLOBAL) stammen aus Magmacore, der gemeinsamen Kernbibliothek. Sie gelten für FreeMinecraftModels-Skripte und andere MagmaCore-ScriptInstance-Consumer. EliteMobs Boss-Powers verwenden dieselbe Lua-Sandbox erneut, stellen aber boss-spezifische Kontexttabellen und Methodennamen bereit; EliteMobs-NPC-Skripte laufen auf derselben MagmaCore-Runtime und erhalten den vollständigen gemeinsamen Kontext plus die nur für NPCs verfügbare context.npc-Tabelle. Siehe die EliteMobs-Abschnitte weiter unten und NPC-Skripte für diese Varianten.
EliteMobs-Methoden (markiert mit ELITEMOBS) sind spezifisch für EliteMobs Boss-Power-Skripte und NPC-Skripte.
FMM-Methoden (markiert mit FMM) sind spezifisch für FreeMinecraftModels Item- und Prop-Skripte.
Wenn eine Methode ein Bukkit-Enum benötigt (Sound, Particle, Material usw.), siehe die Spigot-Javadocs für gültige Werte. Enum-Namen werden als Großbuchstaben-Strings übergeben (z. B. "DIAMOND_SWORD", "ENTITY_ARROW_SHOOT").
Entity Table GLOBAL
Basisfelder, die auf allen Entity-Tabellen vorhanden sind — Spieler, Mobs, Props, alles.
Eigenschaften
| Field | Type | Description |
|---|---|---|
uuid | string | Entity-UUID |
entity_type | string | Entity-Typ (kleingeschrieben) |
is_valid | bool | Entity existiert noch in der Welt |
is_dead | bool | Entity ist tot |
is_player | bool | Ist ein Spieler |
is_hostile | bool | Ist ein Monster |
is_passive | bool | Ist ein Tier |
current_location | location | Entity-Position (x, y, z, yaw, pitch, world) |
world | string | Weltname |
Plugin-spezifische Enricher können zusätzliche Felder auf oberster Ebene hinzufügen, wenn das jeweilige Plugin installiert ist. Siehe die Bridge-Abschnitte weiter unten für EliteMobs- und FreeMinecraftModels-Felder.
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
teleport(location) | location table | nil | Entity teleportieren |
remove() | — | nil | Entity aus der Welt entfernen |
set_silent(enabled) | bool | nil | Stummschaltung setzen |
set_invulnerable(enabled) | bool | nil | Unverwundbarkeit setzen |
set_gravity(enabled) | bool | nil | Schwerkraft setzen |
set_glowing(enabled) | bool | nil | Leuchten setzen |
Bridge: entity.elite
Wird vom Entity-Enricher von EliteMobs hinzugefügt, wenn EliteMobs installiert ist. Der Enricher fügt diese Flags auf oberster Ebene hinzu:
| Field | Type | Description |
|---|---|---|
is_elite | bool | Ist eine EliteMobs-Entity |
is_custom_boss | bool | Ist ein EliteMobs Custom Boss |
is_significant_boss | bool | Custom Boss mit Gesundheitsmultiplikator über 1 (bewusst gestaltete Begegnung) |
entity.elite ist nur vorhanden, wenn is_elite true ist.
| Field | Type | Description |
|---|---|---|
level | int | Level des Elite-Mobs |
name | string | Anzeigename des Elites |
health | double | Aktuelle Gesundheit |
max_health | double | Maximale Gesundheit |
is_custom_boss | bool | Ist ein Custom Boss (auch auf der obersten Ebene verfügbar) |
health_multiplier | double | Konfigurationsdefinierter Gesundheitsmultiplikator |
damage_multiplier | double | Konfigurationsdefinierter Schadensmultiplikator |
remove() | method | Die Elite-Entity entfernen |
Bridge: entity.model
Wird vom Entity-Enricher von FreeMinecraftModels hinzugefügt, wenn FMM installiert ist. Der Enricher fügt diese Flags auf oberster Ebene hinzu:
| Field | Type | Description |
|---|---|---|
is_modeled | bool | Hat ein FMM-Modell |
is_prop | bool | Ist ein FMM-Prop |
entity.model ist nur vorhanden, wenn is_modeled true ist.
| Field | Type | Description |
|---|---|---|
model_id | string | Name des Modell-Blueprints |
is_dynamic | bool | Ob dies eine FMM DynamicEntity (true) oder ein statisches Prop (false) ist |
play_animation(name, blend?, loop?) | method | Animation abspielen. blend ist standardmäßig false, loop ist standardmäßig false |
stop_animations() | method | Alle Animationen stoppen |
remove() | method | Die modellierte Entity entfernen |
Bridge: Spielerberechtigungen
Wird vom Entity-Enricher von FreeMinecraftModels hinzugefügt, wenn FMM installiert ist. Diese Felder erscheinen nur auf Spieler-Entity-Tabellen:
| Field / Method | Args | Returns | Description |
|---|---|---|---|
has_permission(node) | string | bool | Ob der Spieler den angegebenen Berechtigungsknoten besitzt |
is_op | — | bool | Ob der Spieler ein Server-Operator ist |
Living Entity Table GLOBAL
Erweitert Entity Table. Wird auf alle lebenden Entities (Mobs und Spieler) angewendet.
Eigenschaften
| Field | Type | Description |
|---|---|---|
health | double | Aktuelle Gesundheit |
maximum_health | double | Maximale Gesundheit |
name | string | Anzeigename der Entity |
is_alive | bool | Entity ist nicht tot |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
damage(amount) | double | nil | Schaden an Entity zufügen |
push(x, y, z) | double, double, double | nil | Geschwindigkeitsvektor hinzufügen |
set_facing(x, y, z) | double, double, double | nil | Blickrichtung setzen |
add_potion_effect(type, duration, amplifier) | string (PotionEffectType), int, int | nil | Trankeffekt anhand des Namens anwenden |
remove_potion_effect(type) | string (PotionEffectType) | nil | Trankeffekt anhand des Namens entfernen |
get_scale() | — | number | Aktuelle Entity-Skalierung (Standard 1.0 auf Servern ohne generic.scale-Attribut) |
set_scale(value) | double | nil | Entity-Skalierung über generic.scale-Attribut setzen (No-op auf Servern vor 1.20.5) |
context.player GLOBAL
Spieler-Entity-Tabelle. Erbt alle Felder von Entity und Living Entity.
Eigenschaften
| Field | Type | Description |
|---|---|---|
game_mode | string | survival, creative, adventure, spectator |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
send_message(text) | string | nil | Chatnachricht senden. Unterstützt Farbcodes |
get_held_item() | — | table or nil | Gibt die Felder type, amount, display_name zurück, oder nil bei leerer Hand. type ist ein Bukkit-Material-Name in Großbuchstaben |
consume_held_item(amount?) | int (default 1) | nil | Stack des gehaltenen Items um amount reduzieren |
has_item(material, amount?) | string (Material), int (default 1) | bool | Inventar auf Material prüfen |
get_target_entity(range?) | num (default 50) | entity or nil | Raycast nach der Entity, die der Spieler anvisiert |
get_eye_location() | — | location | Augenposition des Spielers |
get_look_direction() | — | vector | Einheitsrichtungsvektor |
send_block_change(x, y, z, material, ticks?) | int, int, int, string (Material), int (optional) | bool | Fake-Block senden. Setzt sich nach ticks automatisch zurück, falls angegeben |
reset_block(x, y, z) | int, int, int | bool | Fake-Block auf den echten zurücksetzen |
sleep(x, y, z) | num, num, num | nil | Bett-Schlafanimation an Position |
wake_up() | — | nil | Aus dem Schlaf wecken |
show_boss_bar(text, color?, progress, ticks?) | string, string (BarColor, default WHITE), num, int (optional) | nil | Bossleiste anzeigen. Wird nach ticks automatisch ausgeblendet. Unterstützt Farbcodes |
hide_boss_bar() | — | nil | Bossleiste entfernen |
show_action_bar(text, ticks?) | string, int (optional) | nil | Action Bar anzeigen. Wiederholt sich, wenn ticks größer als 0. Unterstützt Farbcodes |
show_title(title, subtitle?, fadeIn, stay, fadeOut) | string, string (default empty), int, int, int | nil | Titelbildschirm anzeigen. Unterstützt Farbcodes |
context.world GLOBAL
Weltoperationen für FreeMinecraftModels-Skripte und andere von Magmacore gestützte ScriptInstance-Runtimes. EliteMobs Boss-Powers gehen von derselben Basistabelle aus und ergänzen die unten aufgeführten EliteMobs-context.world-Erweiterungen und -Überschreibungen.
context.world-Methoden gibt es in zwei austauschbaren Formen: Koordinaten-Stil (x, y, z) und Location-Tabellen-Stil (die *_at_location-Varianten). Beide Formen sind auf den generischen Oberflächen verfügbar, und EliteMobs Boss-Powers behalten die gemeinsamen Basismethoden bei und fügen boss-spezifische Location-Tabellen-Helfer hinzu.
Eigenschaften
| Field | Type | Description |
|---|---|---|
name | string | Weltname |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
get_block_at(x, y, z) | int, int, int | string | Material-Name (kleingeschrieben). Gibt "air" zurück, wenn der Chunk nicht geladen ist |
set_block_at(x, y, z, material) | int, int, int, string (Material) | bool | Blockplatzierung einreihen, wenn das Material gültig ist; nicht geladene Chunks werden übersprungen |
get_highest_block_y(x, z) | int, int | int | Y des höchsten Nicht-Luft-Blocks |
spawn_particle(particle, x, y, z, count?, dx?, dy?, dz?, speed?) | string (Particle), num, num, num, int?=1, num?=0, num?=0, num?=0, num?=0 | nil | Partikeleffekt spawnen |
play_sound(sound, x, y, z, volume?, pitch?) | string (Sound), num, num, num, float?=1, float?=1 | nil | Sound abspielen |
strike_lightning(x, y, z) | num, num, num | nil | Blitz einschlagen lassen |
get_time() | — | int | Weltzeit in Ticks |
set_time(ticks) | long | nil | Weltzeit setzen |
get_nearby_entities(x, y, z, radius) | num, num, num, num | table | Array von Entity-Tabellen |
get_nearby_players(x, y, z, radius) | num, num, num, num | table | Array von Spieler-Entity-Tabellen |
spawn_entity(type, x, y, z) | string (EntityType), num, num, num | entity or nil | Vanilla-Entity spawnen; gibt nil zurück, wenn der Entity-Typ ungültig ist |
raycast(fx, fy, fz, dx, dy, dz, max?) | num, num, num, num, num, num, num?=50 | table | Gibt die Felder hit_entity, hit_location, hit_block zurück |
place_temporary_block(x, y, z, material, ticks?, require_air?) | int, int, int, string (Material), int?=0, bool?=false | bool | Blockersetzung einreihen, die sich nach ticks automatisch zurücksetzt. Gibt false zurück, wenn das Material ungültig oder der Chunk nicht geladen ist |
drop_item(x, y, z, material, amount?) | num, num, num, string (Material), int?=1 | entity or nil | Item-Entity natürlich an Position droppen; gibt nil zurück, wenn das Material ungültig ist |
spawn_firework(x, y, z, colors, type?, power?) | num, num, num, table, string (FireworkEffect.Type)?=BALL, int?=1 | nil | Feuerwerk spawnen |
strike_lightning_at_location(loc) | location | nil | Blitz einschlagen lassen |
play_sound_at_location(loc, sound, volume?, pitch?) | location, string (Sound), float?=1, float?=1 | nil | Sound abspielen |
spawn_particle_at_location(loc, particle, count?, dx?, dy?, dz?, speed?) | location, string (Particle), int?=1, num?=0, num?=0, num?=0, num?=0 | nil | Partikeleffekt spawnen |
get_block_at_location(loc) | location | string | Material-Name (kleingeschrieben). Gibt "air" zurück, wenn der Chunk nicht geladen ist |
set_block_at_location(loc, material) | location, string (Material) | bool | Blockplatzierung einreihen, wenn das Material gültig ist; nicht geladene Chunks werden übersprungen |
place_temporary_block_at_location(loc, material, ticks?, require_air?) | location, string (Material), int?=0, bool?=false | bool | Blockersetzung einreihen, die sich nach ticks automatisch zurücksetzt. Gibt false zurück, wenn das Material ungültig oder der Chunk nicht geladen ist |
get_highest_block_y_at_location(loc) | location | int or nil | Y des höchsten Nicht-Luft-Blocks |
em-Helfer GLOBAL
Globale Helfer-Konstruktoren, die auf der em-Tabelle in allen MagmaCore-Lua-Runtimes bereitgestellt werden.
Konstruktoren
| Method | Args | Returns | Description |
|---|---|---|---|
em.create_location(x, y, z, world?, yaw?, pitch?) | num, num, num, string?, num?, num? | location | Location-Tabelle mit x, y, z, optional world, yaw, pitch und einer In-Place-Methode add(dx, dy, dz) |
em.create_vector(x, y, z) | num, num, num | vector | Vektor-Tabelle mit x, y, z |
Zonen-Builder
Zonen-Builder geben einfache Zonen-Definitions-Tabellen zurück. Kugeln, Kuppeln, Zylinder und Quader enthalten :set_center(location). Kegel und Strahlzonen enthalten :set_origin(location) und :set_destination(location).
| Method | Args | Returns | Description |
|---|---|---|---|
em.zone.create_sphere_zone(radius) | num | zone | { kind = "sphere", radius = ... } |
em.zone.create_dome_zone(radius) | num | zone | { kind = "dome", radius = ... } |
em.zone.create_cylinder_zone(radius, height) | num, num | zone | { kind = "cylinder", radius = ..., height = ... } |
em.zone.create_cuboid_zone(x, y, z) | num, num, num | zone | Quader-Halbausdehnungen |
em.zone.create_cone_zone(length, radius) | num, num | zone | Kegel-Definition mit Origin-/Destination-Settern |
em.zone.create_static_ray_zone(length, thickness) | num, num | zone | Statische Strahl-Definition |
em.zone.create_rotating_ray_zone(length, point_radius, animation_duration) | num, num, num | zone | Rotierende Strahl-Definition |
em.zone.create_translating_ray_zone(length, point_radius, animation_duration) | num, num, num | zone | Verschiebende Strahl-Definition |
em.location GLOBAL
Hilfsfunktionen für Standortabfragen, die auf der globalen em-Tabelle bereitgestellt werden. Gestützt durch Magmacores LocationQueryRegistry und den LocationOwnership-Service, der Ergebnisse von registrierten Providern sammelt (EliteMobs-Dungeon/World-Package-Regionen, WorldGuard, GriefPrevention usw.). Alle Funktionen akzeptieren eine Location-Tabelle ({x, y, z, world}) und liefern sichere Standardwerte zurück, wenn die Location ungültig ist.
| Method | Args | Returns | Description |
|---|---|---|---|
em.location.is_in_dungeon(loc) | location | bool | Ob sich die Location innerhalb einer registrierten Dungeon-Region befindet |
em.location.is_protected(loc) | location | bool | Ob ein Provider die Location als geschützt meldet (WorldGuard, GriefPrevention, EM-Regionen usw.) |
em.location.owned_by(loc, namespace) | location, string | bool | Ob der angegebene Namespace die Location besitzt (z. B. "EliteMobs") |
em.location.owners(loc) | location | table | Array von Namespace-Strings, die den Besitz dieser Location beanspruchen |
em.location.kinds_at(loc) | location | table | Array von Kind-Tags an dieser Location (z. B. "elitemobs", "world_package", "open_world_dungeon", Dungeon-Größenkategorie) |
em.location.has_kind(loc, kind) | location, string | bool | Ob die Location das angegebene Kind-Tag besitzt |
context.boss ELITEMOBS
Boss-Entity-Tabelle für EliteMobs Lua-Power-Skripte. Erbt alle Methoden der EliteMobs Living Entity. Eigenschaften werden über dedizierte Getter aktualisiert.
Eigenschaften
| Field | Type | Description |
|---|---|---|
name | string | Anzeigename des Bosses |
uuid | string | UUID der Elite-Entity |
health | double | Aktuelle Gesundheit (Snapshot) |
maximum_health | double | Maximale Gesundheit (Snapshot) |
current_location | location | Boss-Position (Snapshot) |
level | int | Boss-Level |
damager_count | int | Anzahl der Spieler, die diesem Boss Schaden zugefügt haben |
is_in_combat | bool | Boss ist im Kampf |
exists | bool | Boss-Entity existiert |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
is_alive() | — | bool | Ob die Boss-Entity am Leben ist (Live-Prüfung) |
get_health() | — | double | Aktuelle Gesundheit (live) |
get_maximum_health() | — | double | Maximale Gesundheit (live) |
get_location() | — | location | Aktuelle Position (live) |
restore_health(amount) | double | nil | Den Boss heilen |
despawn() | — | nil | Boss-Entity entfernen |
get_damager_count() | — | int | Live-Zähler der Schadensverursacher |
add_tag(tag, ticks?) | string, int?=0 | nil | Tag hinzufügen, automatisch nach ticks entfernen, falls gesetzt |
remove_tag(tag) | string | nil | Tag entfernen |
has_tag(tag) | string | bool | Tag prüfen |
reset_custom_name() | — | nil | Namen auf Konfigurationsstandard zurücksetzen |
play_sound_at_self(sound, volume?, pitch?) | string (Minecraft-Sound-Schlüssel, z. B. "entity.wither.spawn"), float?=1, float?=1 | nil | Sound am Boss abspielen |
play_sound_at_entity(sound, volume?, pitch?) | string (Minecraft-Sound-Schlüssel, z. B. "entity.wither.spawn"), float?=1, float?=1 | nil | Sound am Boss abspielen (Alias) |
spawn_particle_at_self(particle, count?) | string (Particle) or table, int?=1 | nil | Partikel am Boss spawnen |
play_model_animation(name) | string | nil | FMM-Modellanimation abspielen (erfordert FMM-Modell) |
has_mount() | - | bool | Ob dieser Boss auf einer Reit-Entity reitet |
get_mount() | - | entity or nil | Aktuelle Referenz auf die Reit-Entity, markiert mit is_mount = true |
set_mount(entity) | entity table | bool | Lässt den Boss auf der angegebenen Entity reiten |
clear_mount() | - | bool | Lässt den Boss sein aktuelles Reittier verlassen |
dismount() | - | bool | Alias für clear_mount() |
navigate_to_location(location, speed?, force?, timeout?) | location, double?=1, bool?=false, int?=0 | nil | Pfad zur Location finden |
send_message(text, range?) | string, double?=20 | nil | Nachricht an Spieler in der Nähe senden. Unterstützt Farbcodes |
get_nearby_players(range) | double | table | Array von Spieler-Tabellen innerhalb der Reichweite |
get_target_player() | — | player or nil | Aktuelles Mob-Ziel, falls es ein Spieler ist |
get_nearby_players_in_zone(zone) | zone table | table | Spieler innerhalb der Zonenform |
get_ender_dragon_phase() | — | string or nil | EnderDragon.Phase-Name |
set_ender_dragon_phase(phase) | string (EnderDragon.Phase) | nil | EnderDragon-Phase setzen |
summon_reinforcement(file, zone?, level?) | string, zone or nil, int?=0 | entity or nil | Verstärkungs-Boss spawnen |
summon_projectile(type, origin, dest, speed?, options?) | string (EntityType), location, location, double?=1, table | entity or nil | Verfolgtes Projektil spawnen; gibt nil zurück, wenn der Typ oder die Locations ungültig sind |
summon_projectile-Optionen
| Option | Type | Default | Description |
|---|---|---|---|
custom_damage | number | — | Projektil-Schaden überschreiben |
detonation_power | string | — | Explosionsstufe |
yield | number | — | Fireball-Stärke |
incendiary | bool | true | Fireball entzündet |
gravity | bool | — | Schwerkraft aktivieren |
glowing | bool | false | Leuchten setzen |
invulnerable | bool | false | Unverwundbarkeit setzen |
persistent | bool | true | Persistenz setzen |
duration | int | 0 | Nach Ticks automatisch entfernen |
effect | string | — | EntityEffect, der beim Spawn abgespielt wird |
spawn_at_origin | bool | false | Am Ursprung spawnen, statt vom Boss aus zu starten |
direction_only | bool | false | Richtung ohne Geschwindigkeit setzen (Fireballs) |
track | bool | true | Als Elite-Projektil registrieren |
on_land | function | — | Callback, wenn das Projektil landet: function(location, entity) |
max_ticks | int | 6000 | Maximale Ticks vor erzwungenem Land-Callback |
Zonen-/Partikelmethoden
| Method | Args | Returns | Description |
|---|---|---|---|
spawn_particles_in_zone(zone, particle, ...) | zone, particle spec, coverage?=1.0 | nil | Zone mit Partikeln füllen |
spawn_particles_in_zone_border(zone, particle, ...) | zone, particle spec, coverage?=1.0 | nil | Zone mit Partikeln umrahmen |
get_particles_from_self_toward_zone(zone, particle, speed?) | zone, string, double?=0.1 | table | Gerichtete Partikel vom Boss zur Zone |
get_particles_toward_self(zone, particle, speed?) | zone, string, double?=0.1 | table | Gerichtete Partikel von der Zone zum Boss |
spawn_particles_with_vector(particles) | table | nil | Gerichtetes Partikel-Array spawnen |
Unterstützung für Spezial-Powers
| Method | Args | Returns | Description |
|---|---|---|---|
start_tracking_fireball_system(speed?) | double?=0.5 | nil | Verfolgungs-Fireball-KI starten |
handle_spirit_walk_damage(cause) | string (DamageCause) | nil | Spirit-Walk-Schaden nach Ursache verarbeiten |
shield_wall_is_active() | — | bool | Ob die Schildwand aktiv ist |
initialize_shield_wall(charges?) | int?=1 | nil | Schildwand aktivieren |
shield_wall_absorb_damage(player, damage) | entity table, double | bool | Versuch, Schaden zu absorbieren |
deactivate_shield_wall() | — | nil | Schildwand deaktivieren |
start_zombie_necronomicon(target, file) | entity table, string | nil | Necronomicon auf Ziel starten |
context.npc ELITEMOBS NPC
NPC-Tabelle für EliteMobs-NPC-Lua-Skripte. NPC-Skripte liegen in plugins/EliteMobs/npc_scripts/ und werden über eine scripts:-Liste in einer NPC-Konfiguration angehängt. NPC-Skripte laufen auf derselben MagmaCore-Runtime wie jede andere Oberfläche und erhalten den vollständigen gemeinsamen Kontext — context.world, context.zones, context.scheduler, context.cooldowns, context.log, context.event, context.player, context.state — plus die nur für NPCs verfügbare context.npc-Tabelle, die hier dokumentiert ist.
Eigenschaften
| Field | Type | Description |
|---|---|---|
name | string | Anzeigename des NPCs |
filename | string | Dateiname der NPC-Konfiguration |
uuid | string | Laufzeit-NPC-UUID |
activation_radius | double | Konfigurierter Aktivierungsradius |
current_location | location | Snapshot-Location, wenn die NPC-Entity existiert |
entity_type | string | Bukkit-Entity-Typ, wenn die NPC-Entity existiert |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
is_valid() | - | bool | Ob die zugrundeliegende NPC-Entity noch gültig ist |
get_location() | - | location | Aktuelle NPC-Location oder Spawn-Fallback |
get_eye_location() | - | location | Aktuelle Augenposition oder Spawn-Fallback |
get_activation_radius() | - | double | Aktuell konfigurierter Aktivierungsradius |
get_nearby_players(radius) | double | table | Spieler-Tabellen in der Nähe des NPCs |
face_direction_or_location(target) | vector or location | nil | Einer Richtung zuwenden oder zu einer Location schauen |
say_greeting(player?) | player, UUID, name, or nil | nil | Eine konfigurierte Begrüßung senden. Standardmäßig an den auslösenden Spieler, falls verfügbar |
say_dialog(player?) | player, UUID, name, or nil | nil | Konfigurierten Dialog senden. Standardmäßig an den auslösenden Spieler, falls verfügbar |
say_farewell(player?) | player, UUID, name, or nil | nil | Konfigurierten Abschiedstext senden. Standardmäßig an den auslösenden Spieler, falls verfügbar |
play_model_animation(name) | string | nil | Eine benutzerdefinierte Modellanimation abspielen, falls verfügbar; andernfalls sicherer No-op |
Zu den NPC-spezifischen Hooks gehören on_spawn, on_remove, on_game_tick, on_npc_interact, on_npc_proximity_enter und on_npc_proximity_leave. Siehe EliteMobs-NPC-Skripte für den vollständigen Workflow und Cooldown-Details.
EliteMobs Living Entity Table ELITEMOBS
Entity-Tabellen, die innerhalb von EliteMobs-Power-Skripten erstellt werden (aus context.boss, Event-Daten, Zonen-Callbacks und Weltabfragen), verwenden eine erweiterte Living-Entity-Tabelle mit zusätzlichen Methoden über die globale Living Entity hinaus. context.boss erbt all diese.
Eigenschaften
| Field | Type | Description |
|---|---|---|
name | string | Anzeigename der Entity |
uuid | string | Entity-UUID |
entity_type | string | Entity-Typ-Name |
is_player | bool | Ist ein Spieler |
is_monster | bool | Ist ein Monster |
is_elite | bool | Ist eine EliteMobs-Entity |
is_valid | bool | Entity existiert noch |
is_mount | bool | True, wenn diese Entity-Tabelle ein Boss-Reittier darstellt |
health | double | Aktuelle Gesundheit (Snapshot) |
maximum_health | double | Maximale Gesundheit (Snapshot) |
current_location | location | Entity-Position (Snapshot) |
game_mode | string | Spielmodus (in EliteMobs in Großbuchstaben: SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR) |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
is_alive() | — | bool | Ob die Entity am Leben ist (Live-Prüfung) |
is_ai_enabled() | — | bool | Ob die KI aktiviert ist |
is_frozen() | — | bool | Ob der Boss eingefroren ist (nur CustomBossEntity) |
is_on_ground() | — | bool | Ob die Entity auf dem Boden steht |
is_healing() | — | bool | Ob sich der Elite heilt |
get_location() | — | location | Aktuelle Position (live) |
get_eye_location() | — | location | Augenposition (live) |
get_height() | — | double | Entity-Höhe |
get_health() | — | double | Aktuelle Gesundheit (live) |
get_maximum_health() | — | double | Maximale Gesundheit (live) |
get_velocity() | — | vector | Aktueller Geschwindigkeitsvektor |
deal_damage(amount) | double | nil | Generischen Schaden zufügen |
deal_custom_damage(amount) | double | nil | Custom-Boss-Angriffsschaden vom Boss der Power zufügen |
deal_damage_from_boss(amount) | double | nil | Schaden zufügen, der der Boss-Entity der Power zugeschrieben wird |
restore_health(amount) | double | nil | Entity heilen (verwendet EliteMobs-Heilung, falls Elite) |
play_sound_at_entity(sound, volume?, pitch?) | string (Minecraft-Sound-Schlüssel, z. B. "entity.ender_dragon.growl"), float?=1, float?=1 | nil | Sound an Entity abspielen |
play_sound_at_self(sound, volume?, pitch?) | string (Minecraft-Sound-Schlüssel, z. B. "entity.ender_dragon.growl"), float?=1, float?=1 | nil | Sound an Entity abspielen (Alias) |
spawn_particle_at_self(particle, count?) | string (Particle) or table, int?=1 | nil | Partikel an Entity spawnen |
spawn_particles_at_location(loc, particle, count?) | location, particle spec, int?=1 | nil | Partikel an Location spawnen |
teleport_to_location(location) | location | nil | Entity teleportieren |
set_velocity_vector(vector) | vector | nil | Geschwindigkeit setzen |
set_gravity(enabled) | bool | nil | Schwerkraft setzen |
apply_push_vector(vector, additive?, delay?) | vector, bool?=false, int?=1 | nil | Geschwindigkeit nach Verzögerung anwenden. additive addiert zur bestehenden Geschwindigkeit |
push_relative_to(location, force?, extraX?, extraY?, extraZ?) | location, double?=1, double?=0, double?=0, double?=0 | nil | Entity von Location wegstoßen |
set_custom_name(name) | string | nil | Benutzerdefinierten Anzeigenamen setzen. Unterstützt Farbcodes |
reset_custom_name() | — | nil | Namen auf EliteMobs-Standard zurücksetzen |
set_custom_name_visible(visible) | bool | nil | Namenssichtbarkeit umschalten |
set_ai_enabled(enabled, duration?) | bool, int?=0 | nil | KI-Status setzen. Setzt sich nach duration-Ticks automatisch zurück |
set_awareness_enabled(enabled, duration?) | bool, int?=0 | nil | Mob-Wachsamkeit setzen. Setzt sich nach duration-Ticks automatisch zurück |
face_direction_or_location(target) | vector or location | nil | Einer Richtung zuwenden oder zu einer Location schauen |
play_model_animation(name) | string | nil | FMM-Modellanimation abspielen (erfordert FMM-Modell) |
is_inside_vehicle() | - | bool | Ob die Entity auf einer anderen Entity reitet |
has_vehicle() | - | bool | Ob die Entity ein Reittier hat |
get_vehicle() | - | entity or nil | Aktuelle Referenz auf die Reittier-Entity |
set_vehicle(entity) | entity table | bool | Lässt diese Entity auf dem angegebenen Reittier reiten |
leave_vehicle() | - | bool | Lässt diese Entity ihr aktuelles Reittier verlassen |
has_passengers() | - | bool | Ob diese Entity Passagiere hat |
get_passenger_count() | - | int | Anzahl der Passagiere |
get_passengers() | - | table | Array von Passagier-Entity-Referenzen |
add_passenger(entity) | entity table | bool | Fügt dieser Entity einen Passagier hinzu |
remove_passenger(entity) | entity table | bool | Entfernt einen Passagier von dieser Entity |
eject_passengers() | - | bool | Wirft alle Passagiere ab |
set_scale(scale, duration?) | double, int?=0 | nil | Entity-Skalierung setzen. Setzt sich nach duration-Ticks automatisch auf 1.0 zurück |
set_invulnerable(enabled, duration?) | bool, int?=0 | nil | Unverwundbarkeit setzen. Setzt sich nach duration-Ticks automatisch zurück |
set_healing(enabled) | bool | nil | Elite-Heilungsstatus setzen |
navigate_to_location(location, speed?, force?, timeout?) | location, double?=1, bool?=false, int?=0 | nil | Pfad zur Location finden (nur CustomBossEntity) |
add_tag(tag, ticks?) | string, int?=0 | nil | Tag hinzufügen, automatisch nach ticks entfernen |
remove_tag(tag) | string | nil | Tag entfernen |
has_tag(tag) | string | bool | Tag prüfen |
overlaps_box_at_location(center, halfX?, halfY?, halfZ?) | location, double?=0.5, double?=halfX, double?=halfX | bool | Ob die Bounding Box der Entity eine Box an der Location überlappt |
remove_elite() | — | nil | Über die EliteMobs-Entfernungspipeline entfernen |
apply_potion_effect(type, duration, amplifier?) | string (PotionEffectType), int, int?=0 | nil | Trankeffekt anwenden |
set_equipment(slot, material, options?) | string (EquipmentSlot), string (Material), table | nil | Item im Ausrüstungs-Slot setzen |
set_fire_ticks(ticks) | int | nil | Brand-Ticks setzen |
add_visual_freeze_ticks(ticks?) | int?=1 | nil | Visuelle Freeze-Ticks hinzufügen |
place_temporary_block(material, ticks?, requireAir?) | string (Material), int?=0, bool?=false | nil | Temporären Block an Entity-Position platzieren |
set_equipment-Optionen
| Option | Type | Default | Description |
|---|---|---|---|
unbreakable | bool | false | Item unzerbrechlich machen |
enchantments | table | — | Array von {type = "ENCHANT_NAME", level = 1}-Tabellen |
EliteMobs-Spielermethoden
Spieler in EliteMobs-Skripten haben alle EliteMobs-Living-Entity-Methoden plus:
| Method | Args | Returns | Description |
|---|---|---|---|
send_message(text) | string | nil | Chatnachricht senden. Unterstützt Farbcodes |
show_action_bar(text) | string | nil | Action-Bar-Text anzeigen. Unterstützt Farbcodes |
show_title(title, subtitle?, fadeIn?, stay?, fadeOut?) | string, string?="", int?=10, int?=40, int?=10 | nil | Titelbildschirm anzeigen. Unterstützt Farbcodes |
show_boss_bar(title, color?, style?, duration?) | string, string (BarColor)?=WHITE, string (BarStyle)?=SOLID, int?=40 | nil | Bossleiste anzeigen. Wird nach duration-Ticks automatisch ausgeblendet. Unterstützt Farbcodes |
run_command(command) | string | nil | Befehl als Spieler ausführen |
EliteMobs Entity Reference Table
Nicht-lebende Entities (Projektile, fallende Blöcke, Feuerwerke), die von EliteMobs-Spawn-Methoden zurückgegeben werden, erhalten eine schlanke Referenztabelle:
| Field / Method | Args | Returns | Description |
|---|---|---|---|
name | — | string | Entity-Name |
uuid | — | string | Entity-UUID |
entity_type | — | string | Entity-Typ-Name |
is_player | — | bool | Immer false |
is_elite | — | bool | Immer false |
is_valid() | — | bool | Ob die Entity noch gültig ist (Live-Prüfung) |
current_location | — | location | Position (Snapshot) |
get_location() | — | location | Aktuelle Position (live) |
get_velocity() | — | vector | Aktueller Geschwindigkeitsvektor |
is_on_ground() | — | bool | Ob die Entity auf dem Boden steht |
teleport_to_location(location) | location | nil | Entity teleportieren |
set_velocity_vector(vector) | vector | nil | Geschwindigkeit setzen |
set_direction_vector(vector) | vector | nil | Richtung setzen (nur Fireballs) |
set_yield(amount) | double | nil | Fireball-Stärke setzen |
set_gravity(enabled) | bool | nil | Schwerkraft setzen |
detonate() | — | nil | Feuerwerk zünden |
remove() | — | nil | Entity entfernen |
unregister(reason?) | string?=OTHER | nil | Aus EliteMobs-Entity-Tracker abmelden |
context.players ELITEMOBS
Spieler-Abfrage-Tabelle, die in EliteMobs-Power-Skripten verfügbar ist. Stellt Hilfsmethoden bereit, um Spieler relativ zum Boss zu finden.
| Method | Args | Returns | Description |
|---|---|---|---|
current_target() | — | player or nil | Event-Akteur, wenn Spieler, oder aktuelles Mob-Ziel des Bosses, wenn Spieler |
nearby_players(radius) | double | table | Array von Spieler-Tabellen innerhalb des Radius um den Boss |
all_players_in_world() | — | table | Array aller Spieler-Tabellen in der Welt des Bosses |
context.entities ELITEMOBS
Entity-Abfrage-Tabelle, die in EliteMobs-Power-Skripten verfügbar ist. Stellt Hilfsmethoden bereit, um Entities relativ zum Boss zu finden. Alle Abfragen schließen den Boss selbst aus.
| Method | Args | Returns | Description |
|---|---|---|---|
get_nearby_entities(radius, filter?) | double, string?="living" | table | Entities innerhalb des Radius. "all"/"entities" gibt jede Entity zurück (einschließlich nicht-lebender); jeder andere Wert gibt lebende Entities zurück, gefiltert nach Kategorie: "player(s)", "elite(s)", "mob(s)", oder Standard = alle lebenden |
get_entities_in_box(center, halfX, halfY, halfZ, filter?) | location, double, double, double, string?="living" | table | Lebende Entities innerhalb einer achsenausgerichteten Box (dieselben Filterwerte wie oben; nur Nicht-all-Modi) |
get_all_entities(filter?) | string?="living" | table | Alle lebenden Entities in der Welt des Bosses (dieselben Filterwerte) |
get_direct_target_entity() | — | entity or nil | Direkte Ziel-Entity aus dem auslösenden Event |
get_boss_spawn_location() | — | location | Die ursprüngliche Spawn-Location des Bosses |
context.vectors ELITEMOBS
Vektor-Mathematik-Werkzeuge, die in EliteMobs-Power-Skripten verfügbar sind.
| Method | Args | Returns | Description |
|---|---|---|---|
get_vector_between_locations(from, to, options?) | location, location, table | vector | Vektor von Quelle zu Ziel. Optionen können das Ergebnis modifizieren |
rotate_vector(vector, pitch?, yaw?) | vector, double?=0, double?=0 | vector | Vektor um Pitch und Yaw (Grad) drehen |
normalize_vector(vector) | vector | vector | Auf Einheitslänge normalisieren |
context.state GLOBAL
Eine einfache Lua-Tabelle, die während der gesamten Lebensdauer der Skript-Instanz erhalten bleibt. Verwende sie, um Flags, Zähler, Task-IDs, Toggle-Zustände und beliebige Daten zu speichern, die du zwischen Hooks teilen möchtest. context.state ist die skripteigene persistente Tabelle; die meisten anderen Kontexttabellen werden bei Bedarf neu aufgebaut oder verzögert neu erstellt. FMM cacht context.prop pro Prop aus Performance-Gründen, aber dessen Live-Felder wie current_location werden beim Lesen weiterhin aktualisiert.
context.state.counter = (context.state.counter or 0) + 1
context.cooldowns GLOBAL
Cooldown-Verwaltung. Lokale Cooldowns gelten pro Skript-Instanz; globale Cooldowns werden über alle Skripte auf derselben Entity/demselben Besitzer geteilt. Wird kein Schlüssel angegeben, wird standardmäßig der Skriptdateiname verwendet.
| Method | Args | Returns | Description |
|---|---|---|---|
local_ready(key?) | string (optional) | bool | Ob der lokale Cooldown abgelaufen ist |
local_remaining(key?) | string (optional) | int | Verbleibende Ticks im lokalen Cooldown (0, wenn bereit) |
check_local(key?, duration) | string (optional), int | bool | Falls bereit, startet den Cooldown und gibt true zurück; andernfalls false |
set_local(duration, key?) | long, string (optional) | nil | Lokalen Cooldown für duration-Ticks setzen |
global_ready() | — | bool | Ob der globale Cooldown abgelaufen ist |
set_global(duration) | long | nil | Globalen Cooldown für duration-Ticks setzen |
In EliteMobs-Power-Skripten werden lokale Cooldowns über alle Powers auf derselben Boss-Entity geteilt, und globale Cooldowns verwenden das eingebaute Power-Cooldown-System des Bosses.
EliteMobs-NPC-Skripte verwenden die gemeinsame Cooldown-Reihenfolge check_local(key?, duration); siehe NPC-Skripte.
context.scheduler GLOBAL
Task-Scheduling. Alle Tasks werden automatisch abgebrochen, wenn das Skript beendet wird.
Globale (Magmacore) Variante
FreeMinecraftModels-Skripte und EliteMobs-NPC-Skripte verwenden diese gemeinsame Variante. Die EliteMobs-Namen weiter unten sind Aliase auf demselben Scheduler, sodass beide Benennungsstile auf den generischen Oberflächen gültig sind.
| Method | Args | Returns | Description |
|---|---|---|---|
run_later(ticks, callback) | int, function | int | Callback nach ticks ausführen. Gibt Task-ID zurück |
run_repeating(delay, interval, callback) | int, int, function | int | Callback alle interval-Ticks nach initialer Verzögerung ausführen. Gibt Task-ID zurück |
cancel(taskId) | int | nil | Einen geplanten Task abbrechen |
EliteMobs-Variante
| Method | Args | Returns | Description |
|---|---|---|---|
run_after(ticks, callback) | int, function | int | Callback nach ticks ausführen. Gibt Task-ID zurück |
run_every(ticks, callback) | int, function | int | Callback alle N Ticks ausführen. Gibt Task-ID zurück |
cancel_task(taskId) | int | nil | Einen geplanten Task abbrechen |
context.log GLOBAL
Logging-Werkzeuge zum Debuggen von Skripten.
Globale (Magmacore / FMM) Variante
| Method | Args | Returns | Description |
|---|---|---|---|
info(message) | string | nil | Info-Meldung loggen |
warn(message) | string | nil | Warnmeldung loggen |
error(message) | string | nil | Fehler-/Warnmeldung loggen |
EliteMobs-Variante
| Method | Args | Returns | Description |
|---|---|---|---|
info(message) | string | nil | Info-Meldung loggen |
warn(message) | string | nil | Warnmeldung loggen |
debug(message) | string | nil | Debug-Meldung loggen (erscheint als Info mit Debug-Präfix) |
context.zones GLOBAL
Zonen-Erstellung und Überwachung für FreeMinecraftModels-Skripte und andere von Magmacore gestützte ScriptInstance-Runtimes. EliteMobs Boss-Powers verwenden die EliteMobs-context.zones-Variante weiter unten.
Globale (Magmacore) Variante
| Method | Args | Returns | Description |
|---|---|---|---|
create_sphere(x, y, z, radius) | num, num, num, num | int | Kugelzone erstellen, gibt Handle zurück |
create_cylinder(x, y, z, radius, height) | num, num, num, num, num | int | Zylinderzone erstellen, gibt Handle zurück |
create_cuboid(x, y, z, xSize, ySize, zSize) | num, num, num, num, num, num | int | Quaderzone erstellen, gibt Handle zurück |
watch(handle, on_enter?, on_leave?) | int, function?, function? | bool | Zonen-Tracking aktivieren. Funktions-Argumente aktivieren on_zone_enter / on_zone_leave; die Funktionskörper werden nicht direkt aufgerufen. Zonen-Hooks erhalten context.player / context.event.player für den Spieler, der die Grenze überschritten hat |
unwatch(handle) | int | nil | Zonen-Tracking beenden |
EliteMobs-Variante
| Method | Args | Returns | Description |
|---|---|---|---|
get_entities_in_zone(zone, options?) | zone table, table | table | Entities innerhalb der Zone holen. Optionen: filter, mode |
get_locations_in_zone(zone, options?) | zone table, table | table | Locations innerhalb der Zone holen. Optionen: coverage, mode |
zone_contains(zone, location, mode?) | zone table, location, string?="full" | bool | Ob die Location in der Zone ist ("full" oder "border") |
watch_zone(zone, callbacks, options?) | zone table, table, table? | nil | Zone auf Enter/Leave überwachen. Callbacks: {on_enter = fn, on_leave = fn}. Optionen unterstützen filter und mode |
context.event GLOBAL
Event-Daten-Tabelle für den Hook, der die aktuelle Skript-Ausführung ausgelöst hat. Vorhanden während ereignisgesteuerter Hooks und generischer MagmaCore-Zonen-Enter-/Leave-Hooks, die einen Spieler-Akteur bereitstellen; nicht vorhanden während on_game_tick, geplanter Callbacks oder Lifecycle-Hooks ohne Spieler.
Globale (Magmacore) Variante
| Field / Method | Type | Description |
|---|---|---|
is_cancelled | bool | Abbruchstatus zum Zeitpunkt des Kontextaufbaus; wird nach cancel() / uncancel() nicht aktualisiert |
cancel() | method | Das Event abbrechen, wenn das zugrundeliegende Bukkit-Event abbrechbar ist |
uncancel() | method | Den Abbruch des Events aufheben, wenn das zugrundeliegende Bukkit-Event abbrechbar ist |
player | entity table | Am Event beteiligter Spieler (falls vorhanden) |
Generische Zonen-Hooks befüllen player, werden aber nicht von einem abbrechbaren Bukkit-Event gestützt, sodass cancel() und uncancel() dort nicht vorhanden sind.
Zur EliteMobs-Event-Tabelle (die Schadensbeträge, Schadensursachen usw. liefert) siehe EliteMobs Event Table.
context.script ELITEMOBS
Brücke zum EliteMobs Elite-Script-System. Ermöglicht Lua-Powers, die YAML-basierten Targeting-, Zonen- und Relative-Vektor-Systeme über Lua-Tabellen mit denselben Feldnamen wie Elite-Script-YAML-Konfigurationen zu nutzen.
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
target(spec) | table | target handle | Erstellt ein Target-Handle aus einer Elite-Script-Target-Spec-Tabelle |
zone(spec) | table | zone handle | Erstellt ein Zone-Handle aus einer Elite-Script-Zone-Spec-Tabelle |
relative_vector(spec, location?, zone?) | table, location, zone handle | vector handle | Erstellt einen relativen Vektor aus einer Elite-Script-Vektor-Spec |
damage(target, amount?, multiplier?) | target handle, double?=0, double?=1 | nil | Allen Entities im Target Schaden zufügen |
push(target, vector, additive?) | target handle, vector or vector handle, bool?=false | nil | Target-Entities mit Geschwindigkeit stoßen |
set_facing(target, vector) | target handle, vector or vector handle | nil | Blickrichtung der Target-Entities setzen |
spawn_particles(target, particles) | target handle, table or string | nil | Partikel an Target-Locations spawnen |
Target Handle
Wird von context.script:target(spec) zurückgegeben. Die Spec-Tabelle verwendet dieselben Schlüssel wie Elite-Script-YAML-Target-Konfigurationen (z. B. {targetType = "NEARBY_PLAYERS", range = 20}).
| Method | Args | Returns | Description |
|---|---|---|---|
entities() | — | table | Array von Entity-Tabellen am Target |
locations() | — | table | Array von Location-Tabellen am Target |
first_entity() | — | entity or nil | Erste Entity am Target |
first_location() | — | location or nil | Erste Location am Target |
Zone Handle
Wird von context.script:zone(spec) zurückgegeben. Die Spec-Tabelle verwendet dieselben Schlüssel wie Elite-Script-YAML-Zone-Konfigurationen (z. B. {shape = "SPHERE", radius = 5, target = {targetType = "SELF"}}).
| Method | Args | Returns | Description |
|---|---|---|---|
full_target(coverage?) | number | target handle | Target-Handle für innere Zonen-Locations |
border_target(coverage?) | number | target handle | Target-Handle für Zonen-Rand-Locations |
full_locations(coverage?) | number | table | Array innerer Locations |
border_locations(coverage?) | number | table | Array von Rand-Locations |
full_entities() | — | table | Entities innerhalb der Zone |
border_entities() | — | table | Entities am Zonenrand |
contains(location, mode?) | location, string?="full" | bool | Ob die Location in der Zone ist |
watch(callbacks, mode?) | table, string?="full" | int | Auf Enter/Leave überwachen. Gibt Task-ID zurück |
Vector Handle
Wird von context.script:relative_vector(spec) zurückgegeben. Die Spec-Tabelle verwendet dieselben Schlüssel wie Elite-Script-YAML-Relative-Vektor-Konfigurationen.
| Method | Args | Returns | Description |
|---|---|---|---|
resolve() | — | vector | Vektor für den aktuellen Kontext berechnen |
context.world (EliteMobs) ELITEMOBS
Boss-spezifische Welt-Tabelle für EliteMobs-Power-Skripte. Boss-Powers beginnen mit der generischen MagmaCore-Welt-Tabelle, sodass Koordinaten-Helfer wie get_block_at(...), set_block_at(...) und spawn_particle(...) weiterhin verfügbar bleiben. Die folgenden Methoden sind EliteMobs-Ergänzungen oder boss-spezifische Überschreibungen, hauptsächlich Location-Tabellen-Formen und Boss-Helfer.
Block-Abfragen
| Method | Args | Returns | Description |
|---|---|---|---|
get_block_type_at_location(loc) | location | string or nil | Material-Name |
get_highest_block_y_at_location(loc) | location | int or nil | Höchstes Block-Y |
get_blast_resistance_at_location(loc) | location | double | Sprengresistenzwert |
is_air_at_location(loc) | location | bool | Block ist Luft |
is_passable_at_location(loc) | location | bool | Block ist durchquerbar |
is_passthrough_at_location(loc) | location | bool | Block ist nicht solide |
is_on_floor_at_location(loc) | location | bool | Luft mit solidem Block darunter |
is_standing_on_material(loc, material) | location, string (Material) | bool | Block darunter entspricht dem Material |
Blockmanipulation
| Method | Args | Returns | Description |
|---|---|---|---|
set_block_at_location(loc, material, requireAir?) | location, string (Material), bool?=false | nil | Block platzieren. Wenn requireAir true ist, wird nur Luft ersetzt |
place_temporary_block_at_location(loc, material, ticks?, requireAir?) | location, string, int?=0, bool?=false | nil | Block platzieren, nach ticks automatisch entfernen. Wenn requireAir true ist, wird nur Luft ersetzt |
Spawning
| Method | Args | Returns | Description |
|---|---|---|---|
spawn_boss_at_location(file, loc?, level?) | string, location?=boss loc, int?=boss level | entity or nil | Custom Boss spawnen |
spawn_custom_boss_at_location(file, loc, options?) | string, location, table | entity or nil | Boss mit Optionen spawnen (level, silent, add_as_reinforcement, velocity) |
spawn_entity_at_location(type, loc, options?) | string (EntityType), location, table | entity or nil | Vanilla-Entity mit Optionen spawnen (velocity, duration, effect, on_land, max_ticks) |
spawn_falling_block_at_location(loc, material, options?) | location, string (Material), table | entity or nil | Fallenden Block spawnen (drop_item, hurt_entities, velocity, on_land) |
spawn_reinforcement_at_location(file, loc, level?, velocity?) | string, location, int?=0, vector | entity or nil | Verstärkung spawnen, die an den Boss gebunden ist |
spawn_fireworks_at_location(loc, config) | location, table | entity or nil | Feuerwerk spawnen |
spawn_splash_potion_at_location(loc, config) | location, table | entity or nil | Wurftrank spawnen |
Effekte und Hilfsfunktionen
| Method | Args | Returns | Description |
|---|---|---|---|
play_sound_at_location(loc, sound, volume?, pitch?) | location, string (Minecraft-Sound-Schlüssel, z. B. "entity.blaze.shoot"), float?=1, float?=1 | nil | Sound abspielen |
spawn_particle_at_location(loc, particle, count?) | location, string (Particle) or table, int?=1 | nil | Partikel spawnen |
strike_lightning_at_location(loc) | location | nil | Blitz einschlagen lassen (umgeht EM-Schutz) |
run_empowered_lightning_task_at_location(loc) | location | nil | Verstärkter Blitzeffekt |
generate_fake_explosion(locations, center?) | table of locations, location | nil | Visuelle Explosion ohne Schaden |
spawn_fake_gold_nugget_at_location(loc, velocity, gravity?) | location, vector, bool?=false | fake projectile or nil | Visuelles Goldklumpen-Projektil spawnen |
run_fake_gold_nugget_damage(projectiles) | table | nil | Schadensprüfung auf Fake-Projektile ausführen |
set_world_time(time) or (loc, time) | long, or location + long | nil | Weltzeit setzen |
set_world_weather(weather, duration?) or (loc, weather, duration?) | string (CLEAR, RAIN, PRECIPITATION, THUNDER), int?=6000 | nil | Wetter setzen |
run_console_command(command) | string | nil | Konsolenbefehl ausführen |
generate_player_loot(times?) | int?=1 | nil | So viele Spieler-Loot-Würfe für Schadensverursacher ausführen |
drop_bonus_coins(multiplier?) | double?=2 | nil | Bonus-Münzen am Boss droppen |
context.settings (EliteMobs)
| Method | Args | Returns | Description |
|---|---|---|---|
warning_visual_effects_enabled() | — | bool | Ob Warn-VFX in der Konfiguration aktiviert sind |
EliteMobs Event Table
Die context.event-Tabelle wird an Schadens- und Spawn-Hooks übergeben. Felder variieren je nach Event-Typ.
| Field / Method | Type | Present When | Description |
|---|---|---|---|
damage_amount | double | Schadensereignisse | Roher Schadensbetrag |
damage_cause | string | Schadensereignisse | DamageCause-Name |
damager | entity table | Schaden-durch-Entity-Ereignisse | Entity, die den Schaden zugefügt hat |
projectile | entity table | Projektil-Schadensereignisse | Projektil, das den Schaden zugefügt hat |
spawn_reason | string | Spawn-Ereignis | Name des Spawn-Grunds |
entity | entity table | Todes-/Zonen-Ereignisse | Relevante Entity |
cancel_event() | method | Die meisten Ereignisse | Event abbrechen |
set_damage_amount(amount) | method (double) | Schadensereignisse | Schadensbetrag überschreiben |
multiply_damage_amount(multiplier) | method (double) | Schadensereignisse | Aktuellen Schaden multiplizieren |
context.item FMM
In FMM-Item-Skripten zugänglich. Löst das jeweilige skriptgesteuerte Item aus den ausgerüsteten Slots des Spielers per PDC-Tag auf.
Lesemethoden untersuchen das aktuell ausgerüstete passende Item, wenn sie aufgerufen werden. Schreibmethoden reihen ihre Mutation in den Bukkit-Haupt-Thread ein und geben nil zurück.
Eigenschaften
| Field | Type | Description |
|---|---|---|
id | string | Skript-Identifier des Items |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
material() | — | string | Material-Name |
get_amount() | — | int | Stack-Größe |
set_amount(n) | int | nil | Setzen der Stack-Größe einreihen |
consume(n?) | int?=1 | nil | Verringern um n einreihen, bei null entfernen |
get_uses() | — | int | PDC-gespeicherter Verwendungszähler |
set_uses(n) | int | nil | Setzen des PDC-Verwendungszählers einreihen |
get_durability() | — | table or nil | Gibt die Felder current und max zurück, oder nil, wenn keine Haltbarkeitsleiste vorhanden ist |
get_durability_percentage() | — | number or nil | 0.0--1.0 verbleibender Anteil, oder nil |
use_durability(amount, can_break?) | int, bool?=false | nil | Verringern der Haltbarkeit um pauschalen Betrag einreihen. Wenn false, wird auf 1 verbleibend begrenzt |
use_durability_percentage(fraction, can_break?) | number, bool?=false | nil | Verringern der Haltbarkeit um Bruchteil von max einreihen (0.0--1.0) |
get_name() | — | string or nil | Anzeigename |
set_name(s) | string | nil | Setzen des Anzeigenamens einreihen. Unterstützt Farbcodes |
get_lore() | — | table | Array von Lore-Strings |
set_lore(table) | table | nil | Setzen der Lore aus einem Array von Strings einreihen |
context.prop FMM
In FMM-Prop-Skripten zugänglich. Erbt alle Entity-Felder vom zugrundeliegenden Armor Stand.
Eigenschaften
| Field | Type | Description |
|---|---|---|
model_id | string | Name des Blueprint-Modells |
current_location | location | Aktuelle Position des Props |
Methoden
| Method | Args | Returns | Description |
|---|---|---|---|
play_animation(name, blend?, loop?) | string, bool?=true, bool?=true | bool | Benannte Animation abspielen |
stop_animation() | — | nil | Alle aktuellen Animationen stoppen |
hurt_visual() | — | nil | Roter Tönungsblitz, kein Schaden |
pickup() | — | nil | Entfernen des Props und Droppen des Platzierungsitems einreihen |
has_mount_points() | — | bool | Ob das Prop Mount-Point-Knochen besitzt |
mount(player) | entity table | bool | Mount-Prüfung einreihen; true bedeutet, dass die grundlegenden Referenzen gültig waren |
dismount(player) | entity table | bool | Dismount-Prüfung einreihen; true bedeutet, dass die grundlegenden Referenzen gültig waren |
get_passengers() | — | table | Array von Entity-Tabellen aufgesessener Spieler |
spawn_elitemobs_boss(file, x, y, z) | string, num, num, num | entity or nil | EliteMobs-Boss spawnen (erfordert EliteMobs) |
open_inventory(player, title, rows?) | entity table, string, int?=3 | bool | Öffnen eines persistenten Truheninventars einreihen (Reihen auf 1--6 begrenzt). Titel unterstützt Farbcodes |
place_book(player) | entity table | bool | Speichern des vom Spieler gehaltenen geschriebenen/beschreibbaren Buches im Prop einreihen |
read_book(player) | entity table | bool | Öffnen des gespeicherten Buches zum Lesen einreihen |
take_book(player) | entity table | bool | Zurückgeben des gespeicherten Buches an den Spieler einreihen |
has_book() | — | bool | Ob ein Buch gespeichert ist |
drop_inventory() | — | bool | Droppen aller gespeicherten Items und Leeren des Speichers einreihen |
drop_book() | — | bool | Droppen des gespeicherten Buches und Leeren des Speichers einreihen |
is_viewing_inventory(player) | entity table | bool | Ob der Spieler das Inventar dieses Props offen hat |
set_persistent_data(key, value) | string, string | bool | String im PDC des Props speichern |
get_persistent_data(key) | string | string or nil | String aus dem PDC des Props abrufen |
Color Codes
Alle Methoden, die als Unterstützer von Farbcodes markiert sind, verwenden den ChatColorConverter von Magmacore. Diese Formate können in beliebigen Strings frei gemischt werden:
Legacy-Codes
Verwende & gefolgt von einem Farb-/Format-Zeichen:
| Code | Color | Code | Format |
|---|---|---|---|
&0 | Schwarz | &l | Fett |
&1 | Dunkelblau | &m | |
&2 | Dunkelgrün | &n | Unterstrichen |
&3 | Dunkles Türkis | &o | Kursiv |
&4 | Dunkelrot | &r | Zurücksetzen |
&5 | Dunkelviolett | ||
&6 | Gold | ||
&7 | Grau | ||
&8 | Dunkelgrau | ||
&9 | Blau | ||
&a | Grün | ||
&b | Türkis | ||
&c | Rot | ||
&d | Helllila | ||
&e | Gelb | ||
&f | Weiß |
Hex-Farben
Exakte RGB-Farbe mit 6-stelligem Hex-Code:
&#FF5500 -- Ampersand-Präfix
<#FF5500> -- Tag-Syntax
Verläufe
Interpoliert weich zwischen zwei oder mehr Farben über den Text hinweg:
<gradient:#FF0000:#0000FF>This text fades red to blue</gradient>
<g:#FF0000:#00FF00:#0000FF>Three-color gradient</g>
Die Kurzform g funktioniert identisch zu gradient. Du kannst beliebig viele Farbstopps verketten.
Regenbogen
Durchläuft das gesamte Farbtonspektrum bei voller Sättigung. Ein optionales numerisches Argument verschiebt den Start-Farbton (Phasenversatz):
<rainbow>Full rainbow text</rainbow>
<r:0.5>Rainbow with a shifted starting hue</r>
Common Types
location
{ x = number, y = number, z = number, yaw = number, pitch = number, world = string }
vector
{ x = number, y = number, z = number }
entity table
Jede Tabelle mit einem uuid-Feld. Spieler- und Entity-Tabellen aus dem Kontext funktionieren direkt:
context.player -- gültige Entity-Tabelle
context.world:get_nearby_entities(x,y,z,r) -- gibt Array von Entity-Tabellen zurück
Nächste Schritte
- Scripting-Engine: Wie die Engine funktioniert — Sandbox, Scheduling, Cooldowns, Zonen
- EliteMobs: Erste Schritte | NPC-Skripte | Hooks & Lebenszyklus | Boss & Entities | Welt & Umgebung | Zonen & Targeting | Beispiele
- FreeMinecraftModels: Erste Schritte | Prop & Item API | Beispiele