DOMINATOR · LUA API
player
本地玩家的坐标、朝向、状态与转身操作。
Minecraft 1.1.5.1Lua 5.2138 个接口
读取本地玩家坐标、朝向、状态,或对其做朝向/动作操作。
player.data();— 全量数据表(见下表);未注入/未进世界时返回nil,取用前必须判空。player.pos();—{x, y, z}(同时带1/2/3下标与x/y/z键)。player.posOld();— 上一 tick 位置{1=x, 2=y, 3=z}。player.rotation();—{yaw=…, pitch=…}(度)。player.motion();—{1=motionX, 2=motionY, 3=motionZ}。player.heldItem();— 手持物品 ID,未就绪返回-1。player.selectedSlot();— 当前快捷栏槽位 (0–8),未就绪返回-1。player.onGround();— 是否在地面。player.alive();— 是否存活。player.getHealth();— 当前生命值。player.getName();— 本地玩家名字。player.selectedItem();— 当前选中物品(表,见 Item 字段),无则nil。player.setRotation(number yaw, number pitch);— 设置头部旋转(度)。player.sendPos();— 主动发送位置包(转身后让服务端认)。player.swing();— 本地播放挥手动画。
| 字段 | 类型 | 说明 |
|---|---|---|
x y z | number | 当前坐标 |
yaw pitch | number | 头部旋转(度) |
ox oy oz | number | 上一 tick 坐标 |
onGround | boolean | 是否在地面 |
alive | boolean | 是否存活 |
heldItem | number | 手持物品 ID |
selectedSlot | number | 选中槽位 (0–8) |
motionX motionY motionZ | number | 速度向量 |
health | number | 生命值 |
Dominator · Lua API 文档 · 脚本放入 Dominator/LuaScript 目录后自动加载