Lua APIリファレンス
LuaスクリプティングAPIの完全なメソッドリファレンスです。すべてのメソッドは context.table:method() 構文で呼び出します。
Global メソッド(GLOBAL と表記)は共有コアライブラリである Magmacore から提供されます。これらは FreeMinecraftModels スクリプトやその他の MagmaCore ScriptInstance コンシューマに適用されます。EliteMobs のボスパワーは同じ Lua サンドボックスを再利用しますが、ボス固有の context テーブルとメソッド名を公開します。EliteMobs の NPC スクリプトは同じ MagmaCore ランタイム上で動作し、完全な共有 context に加えて NPC 専用の context.npc テーブルを受け取ります。これらのバリアントについては、以下の EliteMobs のセクションと NPC スクリプト を参照してください。
EliteMobs メソッド(ELITEMOBS と表記)は EliteMobs のボスパワースクリプトおよび NPC スクリプト専用です。
FMM メソッド(FMM と表記)は FreeMinecraftModels のアイテムおよびプロップスクリプト専用です。
メソッドが Bukkit の enum (Sound、Particle、Material など) を必要とする場合、有効な値については Spigot Javadocs を参照してください。enum 名は大文字の文字列として渡します(例: "DIAMOND_SWORD"、"ENTITY_ARROW_SHOOT")。
Entity Table GLOBAL
すべてのエンティティテーブル(プレイヤー、モブ、プロップなど)に存在する基本フィールドです。
Properties
| Field | Type | Description |
|---|---|---|
uuid | string | エンティティのUUID |
entity_type | string | エンティティタイプ(小文字) |
is_valid | bool | エンティティがまだワールドに存在する |
is_dead | bool | エンティティが死亡している |
is_player | bool | プレイヤーであるか |
is_hostile | bool | Monster であるか |
is_passive | bool | Animal であるか |
current_location | location | エンティティの位置 (x, y, z, yaw, pitch, world) |
world | string | ワールド名 |
該当するプラグインがインストールされている場合、プラグイン固有の enricher がトップレベルのフィールドを追加することがあります。EliteMobs と FreeMinecraftModels のフィールドについては、以下のブリッジセクションを参照してください。
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
teleport(location) | location table | nil | エンティティをテレポートする |
remove() | — | nil | エンティティをワールドから削除する |
set_silent(enabled) | bool | nil | サイレント状態を設定する |
set_invulnerable(enabled) | bool | nil | 無敵状態を設定する |
set_gravity(enabled) | bool | nil | 重力を設定する |
set_glowing(enabled) | bool | nil | 発光状態を設定する |
Bridge: entity.elite
EliteMobs がインストールされているとき、EliteMobs のエンティティ enricher によって追加されます。この enricher は以下のトップレベルフラグを追加します:
| Field | Type | Description |
|---|---|---|
is_elite | bool | EliteMobs のエンティティであるか |
is_custom_boss | bool | EliteMobs のカスタムボスであるか |
is_significant_boss | bool | health multiplier が 1 を超えるカスタムボス(設計された遭遇) |
entity.elite は is_elite が true の場合のみ存在します。
| Field | Type | Description |
|---|---|---|
level | int | エリートモブのレベル |
name | string | エリートの表示名 |
health | double | 現在の体力 |
max_health | double | 最大体力 |
is_custom_boss | bool | カスタムボスであるか(トップレベルでも参照可能) |
health_multiplier | double | 設定で定義された体力倍率 |
damage_multiplier | double | 設定で定義されたダメージ倍率 |
remove() | method | エリートエンティティを削除する |
Bridge: entity.model
FMM がインストールされているとき、FreeMinecraftModels のエンティティ enricher によって追加されます。この enricher は以下のトップレベルフラグを追加します:
| Field | Type | Description |
|---|---|---|
is_modeled | bool | FMM モデルを持つ |
is_prop | bool | FMM プロップであるか |
entity.model は is_modeled が true の場合のみ存在します。
| Field | Type | Description |
|---|---|---|
model_id | string | モデルのブループリント名 |
is_dynamic | bool | FMM の DynamicEntity (true) か静的プロップ (false) か |
play_animation(name, blend?, loop?) | method | アニメーションを再生する。blend のデフォルトは false、loop のデフォルトは false |
stop_animations() | method | すべてのアニメーションを停止する |
remove() | method | モデル付きエンティティを削除する |
Bridge: player permissions
FMM がインストールされているとき、FreeMinecraftModels のエンティティ enricher によって追加されます。これらのフィールドは プレイヤー のエンティティテーブルにのみ表示されます:
| Field / Method | Args | Returns | Description |
|---|---|---|---|
has_permission(node) | string | bool | プレイヤーが指定の権限ノードを持っているか |
is_op | — | bool | プレイヤーがサーバーオペレーターであるか |
Living Entity Table GLOBAL
Entity Table を拡張します。すべての生存エンティティ(モブとプレイヤー)に適用されます。
Properties
| Field | Type | Description |
|---|---|---|
health | double | 現在の体力 |
maximum_health | double | 最大体力 |
name | string | エンティティの表示名 |
is_alive | bool | エンティティが死亡していない |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
damage(amount) | double | nil | エンティティにダメージを与える |
push(x, y, z) | double, double, double | nil | 速度ベクトルを加算する |
set_facing(x, y, z) | double, double, double | nil | 視線方向を設定する |
add_potion_effect(type, duration, amplifier) | string (PotionEffectType), int, int | nil | 名前を指定してポーション効果を適用する |
remove_potion_effect(type) | string (PotionEffectType) | nil | 名前を指定してポーション効果を除去する |
get_scale() | — | number | 現在のエンティティスケール(generic.scale 属性をサポートしないサーバーでは 1.0) |
set_scale(value) | double | nil | generic.scale 属性を介してエンティティスケールを設定する(1.20.5 より前のサーバーでは何もしない) |
context.player GLOBAL
プレイヤーエンティティテーブル。Entity および Living Entity のフィールドをすべて継承します。
Properties
| Field | Type | Description |
|---|---|---|
game_mode | string | survival、creative、adventure、spectator |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
send_message(text) | string | nil | チャットメッセージを送信する。カラーコードに対応 |
get_held_item() | — | table or nil | type、amount、display_name フィールドを返す。手が空なら nil。type は大文字の Bukkit Material 名 |
consume_held_item(amount?) | int (default 1) | nil | 手に持っているアイテムスタックを指定数減らす |
has_item(material, amount?) | string (Material), int (default 1) | bool | インベントリ内に指定マテリアルがあるか確認する |
get_target_entity(range?) | num (default 50) | entity or nil | プレイヤーが見ているエンティティをレイキャストで取得する |
get_eye_location() | — | location | プレイヤーの目の位置 |
get_look_direction() | — | vector | 単位方向ベクトル |
send_block_change(x, y, z, material, ticks?) | int, int, int, string (Material), int (optional) | bool | 偽のブロックを送る。ticks 指定時は自動的に元に戻る |
reset_block(x, y, z) | int, int, int | bool | 偽のブロックを実際のブロックにリセットする |
sleep(x, y, z) | num, num, num | nil | 指定位置でベッドの睡眠アニメーションを行う |
wake_up() | — | nil | 睡眠から目覚めさせる |
show_boss_bar(text, color?, progress, ticks?) | string, string (BarColor, default WHITE), num, int (optional) | nil | ボスバーを表示する。ticks 経過後に自動的に消える。カラーコードに対応 |
hide_boss_bar() | — | nil | ボスバーを削除する |
show_action_bar(text, ticks?) | string, int (optional) | nil | アクションバーを表示する。ticks が 0 より大きい場合は繰り返し送信する。カラーコードに対応 |
show_title(title, subtitle?, fadeIn, stay, fadeOut) | string, string (default empty), int, int, int | nil | タイトル画面を表示する。カラーコードに対応 |
context.world GLOBAL
FreeMinecraftModels スクリプトやその他の Magmacore ベースの ScriptInstance ランタイム向けのワールド操作。EliteMobs のボスパワーはこれと同じ基本テーブルから始まり、以下に記載する EliteMobs の context.world の追加・オーバーライドを重ねます。
context.world のメソッドには相互に置き換え可能な 2 つの形式があります: 座標形式(x, y, z)と location テーブル形式(*_at_location バリアント)です。両方の形式が汎用サーフェスで利用可能で、EliteMobs のボスパワーは共有の基本メソッドを保持しつつ、ボス固有の location テーブルヘルパーを追加します。
Properties
| Field | Type | Description |
|---|---|---|
name | string | ワールド名 |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
get_block_at(x, y, z) | int, int, int | string | Material 名(小文字)。チャンクが未読み込みの場合は "air" を返す |
set_block_at(x, y, z, material) | int, int, int, string (Material) | bool | マテリアルが有効ならブロック設置をキューに入れる。未読み込みチャンクはスキップされる |
get_highest_block_y(x, z) | int, int | int | 最も高い非空気ブロックの Y 座標 |
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 | パーティクルエフェクトを発生させる |
play_sound(sound, x, y, z, volume?, pitch?) | string (Sound), num, num, num, float?=1, float?=1 | nil | サウンドを再生する |
strike_lightning(x, y, z) | num, num, num | nil | 雷を落とす |
get_time() | — | int | ワールド時刻(tick 単位) |
set_time(ticks) | long | nil | ワールド時刻を設定する |
get_nearby_entities(x, y, z, radius) | num, num, num, num | table | エンティティテーブルの配列 |
get_nearby_players(x, y, z, radius) | num, num, num, num | table | プレイヤーエンティティテーブルの配列 |
spawn_entity(type, x, y, z) | string (EntityType), num, num, num | entity or nil | バニラエンティティをスポーンする。エンティティタイプが無効な場合は nil を返す |
raycast(fx, fy, fz, dx, dy, dz, max?) | num, num, num, num, num, num, num?=50 | table | hit_entity、hit_location、hit_block フィールドを返す |
place_temporary_block(x, y, z, material, ticks?, require_air?) | int, int, int, string (Material), int?=0, bool?=false | bool | ticks 経過後に自動的に元に戻るブロックの置換をキューに入れる。マテリアルが無効、またはチャンクが未読み込みの場合は false を返す |
drop_item(x, y, z, material, amount?) | num, num, num, string (Material), int?=1 | entity or nil | 指定位置でアイテムエンティティを自然にドロップする。マテリアルが無効な場合は nil を返す |
spawn_firework(x, y, z, colors, type?, power?) | num, num, num, table, string (FireworkEffect.Type)?=BALL, int?=1 | nil | 花火をスポーンする |
strike_lightning_at_location(loc) | location | nil | 雷を落とす |
play_sound_at_location(loc, sound, volume?, pitch?) | location, string (Sound), float?=1, float?=1 | nil | サウンドを再生する |
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 | パーティクルエフェクトを発生させる |
get_block_at_location(loc) | location | string | Material 名(小文字)。チャンクが未読み込みの場合は "air" を返す |
set_block_at_location(loc, material) | location, string (Material) | bool | マテリアルが有効ならブロック設置をキューに入れる。未読み込みチャンクはスキップされる |
place_temporary_block_at_location(loc, material, ticks?, require_air?) | location, string (Material), int?=0, bool?=false | bool | ticks 経過後に自動的に元に戻るブロックの置換をキューに入れる。マテリアルが無効、またはチャンクが未読み込みの場合は false を返す |
get_highest_block_y_at_location(loc) | location | int or nil | 最も高い非空気ブロックの Y 座標 |
em helpers GLOBAL
すべての MagmaCore Lua ランタイムで em テーブルに公開されるグローバルなヘルパーコンストラクタ。
Constructors
| Method | Args | Returns | Description |
|---|---|---|---|
em.create_location(x, y, z, world?, yaw?, pitch?) | num, num, num, string?, num?, num? | location | x、y、z を持ち、オプションで world、yaw、pitch を持つ location テーブル。インプレースの add(dx, dy, dz) メソッド付き |
em.create_vector(x, y, z) | num, num, num | vector | x、y、z を持つ vector テーブル |
Zone Builders
ゾーンビルダーはプレーンなゾーン定義テーブルを返します。球、ドーム、円柱、直方体は :set_center(location) を含みます。円錐とレイゾーンは :set_origin(location) と :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 | 直方体の半径(half-extents) |
em.zone.create_cone_zone(length, radius) | num, num | zone | origin/destination セッター付きの円錐定義 |
em.zone.create_static_ray_zone(length, thickness) | num, num | zone | 静的レイ定義 |
em.zone.create_rotating_ray_zone(length, point_radius, animation_duration) | num, num, num | zone | 回転レイ定義 |
em.zone.create_translating_ray_zone(length, point_radius, animation_duration) | num, num, num | zone | 平行移動レイ定義 |
em.location GLOBAL
グローバルな em テーブルに公開されているロケーションクエリヘルパー。Magmacore の LocationQueryRegistry と LocationOwnership サービスに支えられ、登録されたプロバイダ(EliteMobs のダンジョン/ワールドパッケージリージョン、WorldGuard、GriefPrevention など)から結果を収集します。すべての関数は location テーブル({x, y, z, world})を受け取り、location が無効な場合は安全なデフォルト値を返します。
| Method | Args | Returns | Description |
|---|---|---|---|
em.location.is_in_dungeon(loc) | location | bool | location が登録済みのダンジョンリージョン内にあるか |
em.location.is_protected(loc) | location | bool | いずれかのプロバイダがこの location を保護対象として報告しているか(WorldGuard、GriefPrevention、EM リージョンなど) |
em.location.owned_by(loc, namespace) | location, string | bool | 指定の namespace がこの location を所有しているか(例: "EliteMobs") |
em.location.owners(loc) | location | table | この location の所有権を主張する namespace 文字列の配列 |
em.location.kinds_at(loc) | location | table | この location における種類タグの配列(例: "elitemobs"、"world_package"、"open_world_dungeon"、ダンジョンサイズカテゴリ) |
em.location.has_kind(loc, kind) | location, string | bool | location が指定の種類タグを持つか |
context.boss ELITEMOBS
EliteMobs の Lua パワースクリプト用のボスエンティティテーブル。EliteMobs Living Entity のすべてのメソッドを継承します。プロパティは専用ゲッターで再取得されます。
Properties
| Field | Type | Description |
|---|---|---|
name | string | ボスの表示名 |
uuid | string | エリートエンティティの UUID |
health | double | 現在の体力(スナップショット) |
maximum_health | double | 最大体力(スナップショット) |
current_location | location | ボスの位置(スナップショット) |
level | int | ボスレベル |
damager_count | int | このボスにダメージを与えたプレイヤー数 |
is_in_combat | bool | ボスが戦闘中である |
exists | bool | ボスエンティティが存在する |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
is_alive() | — | bool | ボスエンティティが生存しているか(ライブチェック) |
get_health() | — | double | 現在の体力(ライブ) |
get_maximum_health() | — | double | 最大体力(ライブ) |
get_location() | — | location | 現在の位置(ライブ) |
restore_health(amount) | double | nil | ボスを回復する |
despawn() | — | nil | ボスエンティティを削除する |
get_damager_count() | — | int | ライブでのダメージ与えた人数 |
add_tag(tag, ticks?) | string, int?=0 | nil | タグを追加し、ticks 指定時は自動的に削除する |
remove_tag(tag) | string | nil | タグを削除する |
has_tag(tag) | string | bool | タグの有無を確認する |
reset_custom_name() | — | nil | 名前を設定のデフォルトにリセットする |
play_sound_at_self(sound, volume?, pitch?) | string (Minecraft サウンドキー、例 "entity.wither.spawn"), float?=1, float?=1 | nil | ボスの位置でサウンドを再生する |
play_sound_at_entity(sound, volume?, pitch?) | string (Minecraft サウンドキー、例 "entity.wither.spawn"), float?=1, float?=1 | nil | ボスの位置でサウンドを再生する(エイリアス) |
spawn_particle_at_self(particle, count?) | string (Particle) or table, int?=1 | nil | ボスの位置でパーティクルを発生させる |
play_model_animation(name) | string | nil | FMM モデルアニメーションを再生する(FMM モデルが必要) |
has_mount() | - | bool | このボスがマウントエンティティに乗っているか |
get_mount() | - | entity or nil | 現在のマウントエンティティ参照。is_mount = true でマークされる |
set_mount(entity) | entity table | bool | ボスを指定のエンティティに乗せる |
clear_mount() | - | bool | ボスを現在の乗り物から降ろす |
dismount() | - | bool | clear_mount() のエイリアス |
navigate_to_location(location, speed?, force?, timeout?) | location, double?=1, bool?=false, int?=0 | nil | 指定位置までパスファインドする |
send_message(text, range?) | string, double?=20 | nil | 近くのプレイヤーにメッセージを送信する。カラーコードに対応 |
get_nearby_players(range) | double | table | 範囲内のプレイヤーテーブルの配列 |
get_target_player() | — | player or nil | 現在のモブのターゲットがプレイヤーなら返す |
get_nearby_players_in_zone(zone) | zone table | table | zone 形状内のプレイヤー |
get_ender_dragon_phase() | — | string or nil | EnderDragon.Phase 名 |
set_ender_dragon_phase(phase) | string (EnderDragon.Phase) | nil | エンダードラゴンのフェーズを設定する |
summon_reinforcement(file, zone?, level?) | string, zone or nil, int?=0 | entity or nil | 増援ボスをスポーンする |
summon_projectile(type, origin, dest, speed?, options?) | string (EntityType), location, location, double?=1, table | entity or nil | 追跡対象の発射物をスポーンする。type または location が無効な場合は nil を返す |
summon_projectile options
| Option | Type | Default | Description |
|---|---|---|---|
custom_damage | number | — | 発射物のダメージを上書きする |
detonation_power | string | — | 爆発威力のレベル |
yield | number | — | ファイアボールの威力 |
incendiary | bool | true | ファイアボールが炎上させる |
gravity | bool | — | 重力を有効化する |
glowing | bool | false | 発光を設定する |
invulnerable | bool | false | 無敵を設定する |
persistent | bool | true | 永続化を設定する |
duration | int | 0 | ticks 経過後に自動削除する |
effect | string | — | スポーン時に再生する EntityEffect |
spawn_at_origin | bool | false | ボスから発射せず origin の位置でスポーンする |
direction_only | bool | false | 速度なしで方向のみ設定する(ファイアボール) |
track | bool | true | エリート発射物として登録する |
on_land | function | — | 発射物が着地したときのコールバック: function(location, entity) |
max_ticks | int | 6000 | 強制着地コールバックまでの最大 tick 数 |
Zone/Particle Methods
| Method | Args | Returns | Description |
|---|---|---|---|
spawn_particles_in_zone(zone, particle, ...) | zone, particle spec, coverage?=1.0 | nil | zone をパーティクルで埋める |
spawn_particles_in_zone_border(zone, particle, ...) | zone, particle spec, coverage?=1.0 | nil | zone の輪郭をパーティクルで描く |
get_particles_from_self_toward_zone(zone, particle, speed?) | zone, string, double?=0.1 | table | ボスから zone へ向かう方向性パーティクル |
get_particles_toward_self(zone, particle, speed?) | zone, string, double?=0.1 | table | zone からボスへ向かう方向性パーティクル |
spawn_particles_with_vector(particles) | table | nil | 方向性パーティクル配列をスポーンする |
Special Power Support
| Method | Args | Returns | Description |
|---|---|---|---|
start_tracking_fireball_system(speed?) | double?=0.5 | nil | 追跡ファイアボール AI を開始する |
handle_spirit_walk_damage(cause) | string (DamageCause) | nil | スピリットウォークのダメージを cause に応じて処理する |
shield_wall_is_active() | — | bool | シールドウォールが有効か |
initialize_shield_wall(charges?) | int?=1 | nil | シールドウォールを有効化する |
shield_wall_absorb_damage(player, damage) | entity table, double | bool | ダメージを吸収しようとする |
deactivate_shield_wall() | — | nil | シールドウォールを無効化する |
start_zombie_necronomicon(target, file) | entity table, string | nil | ターゲットに対してネクロノミコンを開始する |
context.npc ELITEMOBS NPC
EliteMobs NPC Lua スクリプト用の NPC テーブル。NPC スクリプトは plugins/EliteMobs/npc_scripts/ に置かれ、NPC 設定の scripts: リストを通じてアタッチされます。NPC スクリプトは他のすべてのサーフェスと同じ MagmaCore ランタイム上で動作し、完全な共有 context — context.world、context.zones、context.scheduler、context.cooldowns、context.log、context.event、context.player、context.state — に加えて、ここで説明する NPC 専用の context.npc テーブルを受け取ります。
Properties
| Field | Type | Description |
|---|---|---|
name | string | NPC の表示名 |
filename | string | NPC 設定のファイル名 |
uuid | string | ランタイムの NPC UUID |
activation_radius | double | 設定された有効化半径 |
current_location | location | NPC エンティティが存在するときのスナップショット位置 |
entity_type | string | NPC エンティティが存在するときの Bukkit エンティティタイプ |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
is_valid() | - | bool | NPC の背後のエンティティがまだ有効か |
get_location() | - | location | 現在の NPC の位置、またはスポーン時のフォールバック |
get_eye_location() | - | location | 現在の目の位置、またはスポーン時のフォールバック |
get_activation_radius() | - | double | 現在設定されている有効化半径 |
get_nearby_players(radius) | double | table | NPC の近くのプレイヤーテーブル |
face_direction_or_location(target) | vector or location | nil | 方向を向く、または指定位置の方を見る |
say_greeting(player?) | player、UUID、name、または nil | nil | 設定された挨拶を送る。利用可能な場合はトリガーしたプレイヤーがデフォルト |
say_dialog(player?) | player、UUID、name、または nil | nil | 設定された会話を送る。利用可能な場合はトリガーしたプレイヤーがデフォルト |
say_farewell(player?) | player、UUID、name、または nil | nil | 設定された別れの言葉を送る。利用可能な場合はトリガーしたプレイヤーがデフォルト |
play_model_animation(name) | string | nil | 利用可能ならカスタムモデルアニメーションを再生する。そうでなければ安全に何もしない |
NPC 固有のフックには on_spawn、on_remove、on_game_tick、on_npc_interact、on_npc_proximity_enter、on_npc_proximity_leave があります。完全なワークフローとクールダウンの詳細については EliteMobs NPC スクリプト を参照してください。
EliteMobs Living Entity Table ELITEMOBS
EliteMobs パワースクリプト内で作成されるエンティティテーブル(context.boss、イベントデータ、zone コールバック、ワールドクエリから取得)は、グローバル Living Entity に加えて追加メソッドを持つ拡張 living entity テーブルを使用します。context.boss はこれらすべてを継承します。
Properties
| Field | Type | Description |
|---|---|---|
name | string | エンティティの表示名 |
uuid | string | エンティティの UUID |
entity_type | string | エンティティタイプ名 |
is_player | bool | プレイヤーであるか |
is_monster | bool | Monster であるか |
is_elite | bool | EliteMobs のエンティティであるか |
is_valid | bool | エンティティがまだ存在する |
is_mount | bool | このエンティティテーブルがボスのマウントを表す場合は true |
health | double | 現在の体力(スナップショット) |
maximum_health | double | 最大体力(スナップショット) |
current_location | location | エンティティの位置(スナップショット) |
game_mode | string | ゲームモード(EliteMobs では大文字: SURVIVAL、CREATIVE、ADVENTURE、SPECTATOR) |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
is_alive() | — | bool | エンティティが生存しているか(ライブチェック) |
is_ai_enabled() | — | bool | AI が有効か |
is_frozen() | — | bool | ボスが凍結しているか(CustomBossEntity のみ) |
is_on_ground() | — | bool | エンティティが地面にいるか |
is_healing() | — | bool | エリートが回復中か |
get_location() | — | location | 現在の位置(ライブ) |
get_eye_location() | — | location | 目の位置(ライブ) |
get_height() | — | double | エンティティの高さ |
get_health() | — | double | 現在の体力(ライブ) |
get_maximum_health() | — | double | 最大体力(ライブ) |
get_velocity() | — | vector | 現在の速度ベクトル |
deal_damage(amount) | double | nil | 汎用ダメージを与える |
deal_custom_damage(amount) | double | nil | パワーのボスからカスタムボス攻撃ダメージを与える |
deal_damage_from_boss(amount) | double | nil | パワーのボスエンティティに帰属するダメージを与える |
restore_health(amount) | double | nil | エンティティを回復する(エリートなら EliteMobs の回復を使用) |
play_sound_at_entity(sound, volume?, pitch?) | string (Minecraft サウンドキー、例 "entity.ender_dragon.growl"), float?=1, float?=1 | nil | エンティティの位置でサウンドを再生する |
play_sound_at_self(sound, volume?, pitch?) | string (Minecraft サウンドキー、例 "entity.ender_dragon.growl"), float?=1, float?=1 | nil | エンティティの位置でサウンドを再生する(エイリアス) |
spawn_particle_at_self(particle, count?) | string (Particle) or table, int?=1 | nil | エンティティの位置でパーティクルを発生させる |
spawn_particles_at_location(loc, particle, count?) | location, particle spec, int?=1 | nil | 指定位置でパーティクルを発生させる |
teleport_to_location(location) | location | nil | エンティティをテレポートする |
set_velocity_vector(vector) | vector | nil | 速度を設定する |
set_gravity(enabled) | bool | nil | 重力を設定する |
apply_push_vector(vector, additive?, delay?) | vector, bool?=false, int?=1 | nil | 遅延後に速度を適用する。additive は既存の速度に加算する |
push_relative_to(location, force?, extraX?, extraY?, extraZ?) | location, double?=1, double?=0, double?=0, double?=0 | nil | 指定位置からエンティティを押し離す |
set_custom_name(name) | string | nil | カスタム表示名を設定する。カラーコードに対応 |
reset_custom_name() | — | nil | 名前を EliteMobs のデフォルトにリセットする |
set_custom_name_visible(visible) | bool | nil | 名前の表示を切り替える |
set_ai_enabled(enabled, duration?) | bool, int?=0 | nil | AI 状態を設定する。duration ticks 後に自動的に元に戻る |
set_awareness_enabled(enabled, duration?) | bool, int?=0 | nil | モブの認識を設定する。duration ticks 後に自動的に元に戻る |
face_direction_or_location(target) | vector or location | nil | 方向を向く、または指定位置の方を見る |
play_model_animation(name) | string | nil | FMM モデルアニメーションを再生する(FMM モデルが必要) |
is_inside_vehicle() | - | bool | エンティティが別のエンティティに乗っているか |
has_vehicle() | - | bool | エンティティが乗り物を持っているか |
get_vehicle() | - | entity or nil | 現在の乗り物エンティティ参照 |
set_vehicle(entity) | entity table | bool | このエンティティを指定の乗り物に乗せる |
leave_vehicle() | - | bool | このエンティティを現在の乗り物から降ろす |
has_passengers() | - | bool | このエンティティに搭乗者がいるか |
get_passenger_count() | - | int | 搭乗者の数 |
get_passengers() | - | table | 搭乗者エンティティ参照の配列 |
add_passenger(entity) | entity table | bool | このエンティティに搭乗者を追加する |
remove_passenger(entity) | entity table | bool | このエンティティから搭乗者を削除する |
eject_passengers() | - | bool | すべての搭乗者を降ろす |
set_scale(scale, duration?) | double, int?=0 | nil | エンティティスケールを設定する。duration ticks 後に 1.0 に戻る |
set_invulnerable(enabled, duration?) | bool, int?=0 | nil | 無敵を設定する。duration ticks 後に自動的に元に戻る |
set_healing(enabled) | bool | nil | エリートの回復状態を設定する |
navigate_to_location(location, speed?, force?, timeout?) | location, double?=1, bool?=false, int?=0 | nil | 指定位置までパスファインドする(CustomBossEntity のみ) |
add_tag(tag, ticks?) | string, int?=0 | nil | タグを追加し、ticks 経過後に自動削除する |
remove_tag(tag) | string | nil | タグを削除する |
has_tag(tag) | string | bool | タグの有無を確認する |
overlaps_box_at_location(center, halfX?, halfY?, halfZ?) | location, double?=0.5, double?=halfX, double?=halfX | bool | エンティティのバウンディングボックスが指定位置のボックスと重なるか |
remove_elite() | — | nil | EliteMobs の削除パイプラインで削除する |
apply_potion_effect(type, duration, amplifier?) | string (PotionEffectType), int, int?=0 | nil | ポーション効果を適用する |
set_equipment(slot, material, options?) | string (EquipmentSlot), string (Material), table | nil | 装備スロットにアイテムを設定する |
set_fire_ticks(ticks) | int | nil | 炎上 tick を設定する |
add_visual_freeze_ticks(ticks?) | int?=1 | nil | 凍結ビジュアル tick を追加する |
place_temporary_block(material, ticks?, requireAir?) | string (Material), int?=0, bool?=false | nil | エンティティの位置に一時ブロックを設置する |
set_equipment options
| Option | Type | Default | Description |
|---|---|---|---|
unbreakable | bool | false | アイテムを壊れないようにする |
enchantments | table | — | {type = "ENCHANT_NAME", level = 1} テーブルの配列 |
EliteMobs Player Methods
EliteMobs スクリプト内のプレイヤーは、EliteMobs living entity のすべてのメソッドに加えて以下を持ちます:
| Method | Args | Returns | Description |
|---|---|---|---|
send_message(text) | string | nil | チャットメッセージを送信する。カラーコードに対応 |
show_action_bar(text) | string | nil | アクションバーのテキストを表示する。カラーコードに対応 |
show_title(title, subtitle?, fadeIn?, stay?, fadeOut?) | string, string?="", int?=10, int?=40, int?=10 | nil | タイトル画面を表示する。カラーコードに対応 |
show_boss_bar(title, color?, style?, duration?) | string, string (BarColor)?=WHITE, string (BarStyle)?=SOLID, int?=40 | nil | ボスバーを表示する。duration ticks 後に自動的に消える。カラーコードに対応 |
run_command(command) | string | nil | プレイヤーとしてコマンドを実行する |
EliteMobs Entity Reference Table
EliteMobs のスポーンメソッドから返される非生存エンティティ(発射物、落下ブロック、花火)には軽量な参照テーブルが付きます:
| Field / Method | Args | Returns | Description |
|---|---|---|---|
name | — | string | エンティティ名 |
uuid | — | string | エンティティの UUID |
entity_type | — | string | エンティティタイプ名 |
is_player | — | bool | 常に false |
is_elite | — | bool | 常に false |
is_valid() | — | bool | エンティティがまだ有効か(ライブチェック) |
current_location | — | location | 位置(スナップショット) |
get_location() | — | location | 現在の位置(ライブ) |
get_velocity() | — | vector | 現在の速度ベクトル |
is_on_ground() | — | bool | エンティティが地面にいるか |
teleport_to_location(location) | location | nil | エンティティをテレポートする |
set_velocity_vector(vector) | vector | nil | 速度を設定する |
set_direction_vector(vector) | vector | nil | 方向を設定する(ファイアボールのみ) |
set_yield(amount) | double | nil | ファイアボールの威力を設定する |
set_gravity(enabled) | bool | nil | 重力を設定する |
detonate() | — | nil | 花火を起爆する |
remove() | — | nil | エンティティを削除する |
unregister(reason?) | string?=OTHER | nil | EliteMobs のエンティティトラッカーから登録解除する |
context.players ELITEMOBS
EliteMobs パワースクリプトで使用可能なプレイヤークエリテーブル。ボスを基準にプレイヤーを検索するヘルパーメソッドを提供します。
| Method | Args | Returns | Description |
|---|---|---|---|
current_target() | — | player or nil | イベントのアクター(プレイヤーの場合)、またはボスの現在のモブターゲット(プレイヤーの場合) |
nearby_players(radius) | double | table | ボスから radius 内のプレイヤーテーブルの配列 |
all_players_in_world() | — | table | ボスのワールド内のすべてのプレイヤーテーブルの配列 |
context.entities ELITEMOBS
EliteMobs パワースクリプトで使用可能なエンティティクエリテーブル。ボスを基準にエンティティを検索するヘルパーメソッドを提供します。すべてのクエリはボス自身を除外します。
| Method | Args | Returns | Description |
|---|---|---|---|
get_nearby_entities(radius, filter?) | double, string?="living" | table | radius 内のエンティティ。"all" / "entities" はすべてのエンティティ(非生存エンティティを含む)を返します。それ以外の値の場合、カテゴリでフィルタリングされた生存エンティティを返します:"player(s)"、"elite(s)"、"mob(s)"、またはデフォルト = すべての生存エンティティ |
get_entities_in_box(center, halfX, halfY, halfZ, filter?) | location, double, double, double, string?="living" | table | 軸合わせボックス内の生存エンティティ(上記と同じフィルタ値、all 以外のモードのみ) |
get_all_entities(filter?) | string?="living" | table | ボスのワールド内のすべての生存エンティティ(同じフィルタ値) |
get_direct_target_entity() | — | entity or nil | トリガーイベントの直接ターゲットエンティティ |
get_boss_spawn_location() | — | location | ボスの元のスポーン位置 |
context.vectors ELITEMOBS
EliteMobs パワースクリプトで使用可能なベクトル数学ユーティリティ。
| Method | Args | Returns | Description |
|---|---|---|---|
get_vector_between_locations(from, to, options?) | location, location, table | vector | 始点から終点へのベクトル。options で結果を変更できる |
rotate_vector(vector, pitch?, yaw?) | vector, double?=0, double?=0 | vector | ベクトルを pitch と yaw(度)で回転させる |
normalize_vector(vector) | vector | vector | 単位長に正規化する |
context.state GLOBAL
スクリプトインスタンスの生存期間全体にわたって持続するプレーンな Lua テーブル。フラグ、カウンタ、タスク ID、トグル状態、フック間で共有したいデータを格納するために使用します。context.state はスクリプトが所有する永続テーブルです。他のほとんどの context テーブルは必要に応じて再構築されるか遅延再生成されます。FMM はパフォーマンスのためにプロップごとに context.prop をキャッシュしますが、current_location などのライブフィールドは読み取り時に依然として更新されます。
context.state.counter = (context.state.counter or 0) + 1
context.cooldowns GLOBAL
クールダウン管理。ローカルクールダウンはスクリプトインスタンスごと、グローバルクールダウンは同じエンティティ/オーナー上のすべてのスクリプト間で共有されます。キーが指定されない場合、スクリプトのファイル名がデフォルトになります。
| Method | Args | Returns | Description |
|---|---|---|---|
local_ready(key?) | string (optional) | bool | ローカルクールダウンが終了したか |
local_remaining(key?) | string (optional) | int | ローカルクールダウンの残り tick(準備完了なら 0) |
check_local(key?, duration) | string (optional), int | bool | 準備完了ならクールダウンを開始して true を返す。そうでなければ false |
set_local(duration, key?) | long, string (optional) | nil | ローカルクールダウンを duration ticks に設定する |
global_ready() | — | bool | グローバルクールダウンが終了したか |
set_global(duration) | long | nil | グローバルクールダウンを duration ticks に設定する |
EliteMobs パワースクリプトでは、ローカルクールダウンは同じボスエンティティ上のすべてのパワーで共有され、グローバルクールダウンはボスに組み込まれたパワークールダウンシステムを使用します。
EliteMobs NPC スクリプトは共有のクールダウン順序 check_local(key?, duration) を使用します。NPC スクリプト を参照してください。
context.scheduler GLOBAL
タスクスケジューリング。すべてのタスクはスクリプトのシャットダウン時に自動的にキャンセルされます。
Global (Magmacore) variant
FreeMinecraftModels スクリプトと EliteMobs NPC スクリプトはこの共有バリアントを使用します。以下の EliteMobs スタイルの名前は同じスケジューラ上のエイリアスなので、どちらの命名スタイルも汎用サーフェスで有効です。
| Method | Args | Returns | Description |
|---|---|---|---|
run_later(ticks, callback) | int, function | int | ticks 後にコールバックを実行する。タスク ID を返す |
run_repeating(delay, interval, callback) | int, int, function | int | 初期遅延後に interval ticks ごとにコールバックを実行する。タスク ID を返す |
cancel(taskId) | int | nil | スケジュール済みタスクをキャンセルする |
EliteMobs variant
| Method | Args | Returns | Description |
|---|---|---|---|
run_after(ticks, callback) | int, function | int | ticks 後にコールバックを実行する。タスク ID を返す |
run_every(ticks, callback) | int, function | int | N tick ごとにコールバックを実行する。タスク ID を返す |
cancel_task(taskId) | int | nil | スケジュール済みタスクをキャンセルする |
context.log GLOBAL
スクリプトのデバッグ用ロギングユーティリティ。
Global (Magmacore / FMM) variant
| Method | Args | Returns | Description |
|---|---|---|---|
info(message) | string | nil | info メッセージを記録する |
warn(message) | string | nil | warning メッセージを記録する |
error(message) | string | nil | error/warning メッセージを記録する |
EliteMobs variant
| Method | Args | Returns | Description |
|---|---|---|---|
info(message) | string | nil | info メッセージを記録する |
warn(message) | string | nil | warning メッセージを記録する |
debug(message) | string | nil | debug メッセージを記録する(debug プレフィックス付きの info として表示) |
context.zones GLOBAL
FreeMinecraftModels スクリプトやその他の Magmacore ベースの ScriptInstance ランタイム向けのゾーン作成と監視。EliteMobs のボスパワーは以下の EliteMobs context.zones バリアントを使用します。
Global (Magmacore) variant
| Method | Args | Returns | Description |
|---|---|---|---|
create_sphere(x, y, z, radius) | num, num, num, num | int | 球ゾーンを作成し、ハンドルを返す |
create_cylinder(x, y, z, radius, height) | num, num, num, num, num | int | 円柱ゾーンを作成し、ハンドルを返す |
create_cuboid(x, y, z, xSize, ySize, zSize) | num, num, num, num, num, num | int | 直方体ゾーンを作成し、ハンドルを返す |
watch(handle, on_enter?, on_leave?) | int, function?, function? | bool | ゾーン追跡を有効にする。function 引数で on_zone_enter / on_zone_leave を有効化する。function 本体は直接呼び出されない。ゾーンフックは境界を越えたプレイヤーの context.player / context.event.player を受け取る |
unwatch(handle) | int | nil | ゾーンの追跡を停止する |
EliteMobs variant
| Method | Args | Returns | Description |
|---|---|---|---|
get_entities_in_zone(zone, options?) | zone table, table | table | zone 内のエンティティを取得する。options: filter、mode |
get_locations_in_zone(zone, options?) | zone table, table | table | zone 内の location を取得する。options: coverage、mode |
zone_contains(zone, location, mode?) | zone table, location, string?="full" | bool | location が zone 内にあるか("full" または "border") |
watch_zone(zone, callbacks, options?) | zone table, table, table? | nil | zone への enter/leave を監視する。callbacks: {on_enter = fn, on_leave = fn}。options は filter と mode をサポート |
context.event GLOBAL
現在のスクリプト実行をトリガーしたフックのイベントデータテーブル。イベント駆動フック、およびプレイヤーアクターを提供する汎用 MagmaCore のゾーン enter/leave フック中に存在します。on_game_tick、スケジュールされたコールバック、プレイヤーを伴わないライフサイクルフックでは存在しません。
Global (Magmacore) variant
| Field / Method | Type | Description |
|---|---|---|
is_cancelled | bool | context が構築された時点でのキャンセル状態。cancel() / uncancel() 後には更新されない |
cancel() | method | 背後の Bukkit イベントがキャンセル可能な場合にイベントをキャンセルする |
uncancel() | method | 背後の Bukkit イベントがキャンセル可能な場合にイベントのキャンセルを取り消す |
player | entity table | イベントに関与するプレイヤー(該当する場合) |
汎用ゾーンフックは player を設定しますが、キャンセル可能な Bukkit イベントに支えられていないため、そこでは cancel() と uncancel() は存在しません。
EliteMobs イベントテーブル(ダメージ量、ダメージ原因などを提供)については EliteMobs Event Table を参照してください。
context.script ELITEMOBS
EliteMobs Elite Script システムへのブリッジ。Lua パワーが Elite Script YAML 設定と同じフィールド名の Lua テーブルを通じて、YAML ベースのターゲット、ゾーン、相対ベクトルシステムを使用できるようにします。
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
target(spec) | table | target handle | Elite Script のターゲット仕様テーブルからターゲットハンドルを作成する |
zone(spec) | table | zone handle | Elite Script のゾーン仕様テーブルからゾーンハンドルを作成する |
relative_vector(spec, location?, zone?) | table, location, zone handle | vector handle | Elite Script のベクトル仕様から相対ベクトルを作成する |
damage(target, amount?, multiplier?) | target handle, double?=0, double?=1 | nil | target 内のすべてのエンティティにダメージを与える |
push(target, vector, additive?) | target handle, vector or vector handle, bool?=false | nil | target エンティティを速度で押す |
set_facing(target, vector) | target handle, vector or vector handle | nil | target エンティティの向きを設定する |
spawn_particles(target, particles) | target handle, table or string | nil | target の location でパーティクルを発生させる |
Target Handle
context.script:target(spec) から返されます。spec テーブルは Elite Script YAML のターゲット設定と同じキーを使用します(例: {targetType = "NEARBY_PLAYERS", range = 20})。
| Method | Args | Returns | Description |
|---|---|---|---|
entities() | — | table | target のエンティティテーブルの配列 |
locations() | — | table | target の location テーブルの配列 |
first_entity() | — | entity or nil | target の最初のエンティティ |
first_location() | — | location or nil | target の最初の location |
Zone Handle
context.script:zone(spec) から返されます。spec テーブルは Elite Script YAML のゾーン設定と同じキーを使用します(例: {shape = "SPHERE", radius = 5, target = {targetType = "SELF"}})。
| Method | Args | Returns | Description |
|---|---|---|---|
full_target(coverage?) | number | target handle | zone 内部の location 用ターゲットハンドル |
border_target(coverage?) | number | target handle | zone 境界の location 用ターゲットハンドル |
full_locations(coverage?) | number | table | 内部 location の配列 |
border_locations(coverage?) | number | table | 境界 location の配列 |
full_entities() | — | table | zone 内部のエンティティ |
border_entities() | — | table | zone 境界上のエンティティ |
contains(location, mode?) | location, string?="full" | bool | location が zone 内にあるか |
watch(callbacks, mode?) | table, string?="full" | int | enter/leave を監視する。タスク ID を返す |
Vector Handle
context.script:relative_vector(spec) から返されます。spec テーブルは Elite Script YAML の相対ベクトル設定と同じキーを使用します。
| Method | Args | Returns | Description |
|---|---|---|---|
resolve() | — | vector | 現在のコンテキストでベクトルを計算する |
context.world (EliteMobs) ELITEMOBS
EliteMobs パワースクリプト用のボス固有ワールドテーブル。ボスパワーは汎用 MagmaCore ワールドテーブルから始まるため、get_block_at(...)、set_block_at(...)、spawn_particle(...) などの座標ヘルパーは引き続き利用可能です。以下のメソッドは EliteMobs の追加またはボス固有のオーバーライドで、主に location テーブル形式とボスヘルパーです。
Block Queries
| Method | Args | Returns | Description |
|---|---|---|---|
get_block_type_at_location(loc) | location | string or nil | Material 名 |
get_highest_block_y_at_location(loc) | location | int or nil | 最も高いブロックの Y |
get_blast_resistance_at_location(loc) | location | double | 爆発耐性値 |
is_air_at_location(loc) | location | bool | ブロックが空気か |
is_passable_at_location(loc) | location | bool | ブロックが通過可能か |
is_passthrough_at_location(loc) | location | bool | ブロックが固体でないか |
is_on_floor_at_location(loc) | location | bool | 下に固体ブロックがある空気か |
is_standing_on_material(loc, material) | location, string (Material) | bool | 下のブロックが指定マテリアルと一致するか |
Block Manipulation
| Method | Args | Returns | Description |
|---|---|---|---|
set_block_at_location(loc, material, requireAir?) | location, string (Material), bool?=false | nil | ブロックを設置する。requireAir が true の場合、空気のみを置き換える |
place_temporary_block_at_location(loc, material, ticks?, requireAir?) | location, string, int?=0, bool?=false | nil | ブロックを設置し、ticks 経過後に自動削除する。requireAir が true の場合、空気のみを置き換える |
Spawning
| Method | Args | Returns | Description |
|---|---|---|---|
spawn_boss_at_location(file, loc?, level?) | string, location?=boss loc, int?=boss level | entity or nil | カスタムボスをスポーンする |
spawn_custom_boss_at_location(file, loc, options?) | string, location, table | entity or nil | options 付きでボスをスポーンする(level、silent、add_as_reinforcement、velocity) |
spawn_entity_at_location(type, loc, options?) | string (EntityType), location, table | entity or nil | options 付きでバニラエンティティをスポーンする(velocity、duration、effect、on_land、max_ticks) |
spawn_falling_block_at_location(loc, material, options?) | location, string (Material), table | entity or nil | 落下ブロックをスポーンする(drop_item、hurt_entities、velocity、on_land) |
spawn_reinforcement_at_location(file, loc, level?, velocity?) | string, location, int?=0, vector | entity or nil | ボスに紐づけられた増援をスポーンする |
spawn_fireworks_at_location(loc, config) | location, table | entity or nil | 花火をスポーンする |
spawn_splash_potion_at_location(loc, config) | location, table | entity or nil | スプラッシュポーションをスポーンする |
Effects and Utility
| Method | Args | Returns | Description |
|---|---|---|---|
play_sound_at_location(loc, sound, volume?, pitch?) | location, string (Minecraft サウンドキー、例 "entity.blaze.shoot"), float?=1, float?=1 | nil | サウンドを再生する |
spawn_particle_at_location(loc, particle, count?) | location, string (Particle) or table, int?=1 | nil | パーティクルを発生させる |
strike_lightning_at_location(loc) | location | nil | 雷を落とす(EM の保護を無視) |
run_empowered_lightning_task_at_location(loc) | location | nil | 強化雷エフェクト |
generate_fake_explosion(locations, center?) | table of locations, location | nil | ダメージのない視覚的な爆発 |
spawn_fake_gold_nugget_at_location(loc, velocity, gravity?) | location, vector, bool?=false | fake projectile or nil | 視覚的な金塊発射物をスポーンする |
run_fake_gold_nugget_damage(projectiles) | table | nil | 偽発射物のダメージチェックを実行する |
set_world_time(time) or (loc, time) | long, or location + long | nil | ワールド時刻を設定する |
set_world_weather(weather, duration?) or (loc, weather, duration?) | string (CLEAR, RAIN, PRECIPITATION, THUNDER), int?=6000 | nil | 天候を設定する |
run_console_command(command) | string | nil | コンソールコマンドを実行する |
generate_player_loot(times?) | int?=1 | nil | ダメージを与えたプレイヤー向けにこの回数だけ戦利品ロールを実行する |
drop_bonus_coins(multiplier?) | double?=2 | nil | ボスの位置にボーナスコインをドロップする |
context.settings (EliteMobs)
| Method | Args | Returns | Description |
|---|---|---|---|
warning_visual_effects_enabled() | — | bool | 警告 VFX が設定で有効かどうか |
EliteMobs Event Table
context.event テーブルはダメージとスポーンのフックに渡されます。フィールドはイベントタイプによって異なります。
| Field / Method | Type | Present When | Description |
|---|---|---|---|
damage_amount | double | Damage events | 生のダメージ量 |
damage_cause | string | Damage events | DamageCause 名 |
damager | entity table | Damage-by-entity events | ダメージを与えたエンティティ |
projectile | entity table | Projectile damage events | ダメージを与えた発射物 |
spawn_reason | string | Spawn event | スポーン理由名 |
entity | entity table | Death/zone events | 関連エンティティ |
cancel_event() | method | Most events | イベントをキャンセルする |
set_damage_amount(amount) | method (double) | Damage events | ダメージ量を上書きする |
multiply_damage_amount(multiplier) | method (double) | Damage events | 現在のダメージを乗算する |
context.item FMM
FMM アイテムスクリプトでアクセスされます。PDC タグを介してプレイヤーの装備スロットからスクリプト化された特定のアイテムを解決します。
読み取りメソッドは、呼び出し時に現在装備されている一致するアイテムを検査します。書き込みメソッドはその変更を Bukkit のメインスレッドにキューイングし、nil を返します。
Properties
| Field | Type | Description |
|---|---|---|
id | string | アイテムのスクリプト識別子 |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
material() | — | string | Material 名 |
get_amount() | — | int | スタックサイズ |
set_amount(n) | int | nil | スタックサイズの設定をキューに入れる |
consume(n?) | int?=1 | nil | 個数を n だけ減らし、0 なら削除する処理をキューに入れる |
get_uses() | — | int | PDC に保存された使用回数カウンタ |
set_uses(n) | int | nil | PDC の使用回数カウンタの設定をキューに入れる |
get_durability() | — | table or nil | current と max フィールドを返す。耐久度バーがない場合は nil |
get_durability_percentage() | — | number or nil | 残量の 0.0--1.0 の割合。または nil |
use_durability(amount, can_break?) | int, bool?=false | nil | 耐久度を一定量減らす処理をキューに入れる。false の場合、残り 1 でクランプする |
use_durability_percentage(fraction, can_break?) | number, bool?=false | nil | 耐久度を最大値の割合(0.0--1.0)で減らす処理をキューに入れる |
get_name() | — | string or nil | 表示名 |
set_name(s) | string | nil | 表示名の設定をキューに入れる。カラーコードに対応 |
get_lore() | — | table | lore 文字列の配列 |
set_lore(table) | table | nil | 文字列の配列から lore の設定をキューに入れる |
context.prop FMM
FMM プロップスクリプトでアクセスされます。背後にあるアーマースタンドから Entity のすべてのフィールドを継承します。
Properties
| Field | Type | Description |
|---|---|---|
model_id | string | ブループリントモデル名 |
current_location | location | プロップの現在位置 |
Methods
| Method | Args | Returns | Description |
|---|---|---|---|
play_animation(name, blend?, loop?) | string, bool?=true, bool?=true | bool | 名前付きアニメーションを再生する |
stop_animation() | — | nil | 現在のすべてのアニメーションを停止する |
hurt_visual() | — | nil | 赤い色合いのフラッシュ。ダメージなし |
pickup() | — | nil | プロップを削除して設置アイテムをドロップする処理をキューに入れる |
has_mount_points() | — | bool | プロップにマウントポイントボーンがあるか |
mount(player) | entity table | bool | マウントチェックをキューに入れる。true は基本参照が有効だったことを意味する |
dismount(player) | entity table | bool | マウント解除チェックをキューに入れる。true は基本参照が有効だったことを意味する |
get_passengers() | — | table | マウントされたプレイヤーのエンティティテーブルの配列 |
spawn_elitemobs_boss(file, x, y, z) | string, num, num, num | entity or nil | EliteMobs ボスをスポーンする(EliteMobs が必要) |
open_inventory(player, title, rows?) | entity table, string, int?=3 | bool | 永続チェストインベントリを開く処理をキューに入れる(行数は 1--6 にクランプ)。title はカラーコードに対応 |
place_book(player) | entity table | bool | プレイヤーが持っている書かれた/書き込み可能な本をプロップに保管する処理をキューに入れる |
read_book(player) | entity table | bool | 保管されている本を読むために開く処理をキューに入れる |
take_book(player) | entity table | bool | 保管されている本をプレイヤーに返す処理をキューに入れる |
has_book() | — | bool | 本が保管されているか |
drop_inventory() | — | bool | 保管されているすべてのアイテムをドロップしてストレージをクリアする処理をキューに入れる |
drop_book() | — | bool | 保管されている本をドロップしてストレージをクリアする処理をキューに入れる |
is_viewing_inventory(player) | entity table | bool | プレイヤーがこのプロップのインベントリを開いているか |
set_persistent_data(key, value) | string, string | bool | プロップの PDC に文字列を格納する |
get_persistent_data(key) | string | string or nil | プロップの PDC から文字列を取得する |
Color Codes
カラーコードをサポートすると記載されたすべてのメソッドは、Magmacore の ChatColorConverter を使用します。これらのフォーマットはどの文字列内でも自由に組み合わせられます:
Legacy codes
& の後にカラー/フォーマット文字を続けます:
| Code | Color | Code | Format |
|---|---|---|---|
&0 | Black | &l | Bold |
&1 | Dark Blue | &m | |
&2 | Dark Green | &n | Underline |
&3 | Dark Aqua | &o | Italic |
&4 | Dark Red | &r | Reset |
&5 | Dark Purple | ||
&6 | Gold | ||
&7 | Gray | ||
&8 | Dark Gray | ||
&9 | Blue | ||
&a | Green | ||
&b | Aqua | ||
&c | Red | ||
&d | Light Purple | ||
&e | Yellow | ||
&f | White |
Hex colors
6 桁の 16 進数で正確な RGB カラーを指定します:
&#FF5500 -- ampersand prefix
<#FF5500> -- tag syntax
Gradients
テキスト全体で 2 色以上をなめらかに補間します:
<gradient:#FF0000:#0000FF>This text fades red to blue</gradient>
<g:#FF0000:#00FF00:#0000FF>Three-color gradient</g>
短縮形の g は gradient と同じように動作します。色の停止点はいくつでも連鎖できます。
Rainbow
完全な彩度で色相スペクトル全体を循環します。任意の数値引数で開始色相をシフトできます(位相オフセット):
<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
uuid フィールドを持つ任意のテーブル。context のプレイヤーおよびエンティティテーブルはそのまま動作します:
context.player -- valid entity table
context.world:get_nearby_entities(x,y,z,r) -- returns array of entity tables
Next Steps
- Scripting Engine: エンジンの仕組み — サンドボックス、スケジューリング、クールダウン、ゾーン
- EliteMobs: はじめに | NPC スクリプト | フックとライフサイクル | ボスとエンティティ | ワールドと環境 | ゾーンとターゲティング | 例
- FreeMinecraftModels: はじめに | プロップとアイテム API | 例