实体
abi.h 里的分节说明
§C 实体(玩家也可以经 player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
实体:关系、装备、效果、几何(专用函数)(Actor: relationships, equipment, effects, geometry (dedicated fns))
槽位
list_actors
| C |
|---|
| void (*list_actors)(int32_t dim, void* ctx, PierActorSink sink);
|
列出活着的实体;dim 为 -1 表示所有维度。
- 调用形式:
api->list_actors(dim, ctx, sink)
- 参数:
- dim :
int32_t
- ctx :
void*
- sink :
PierActorSink
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 32 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_snapshot
| C |
|---|
| bool (*actor_snapshot)(PierActorId id, void* ctx, PierStrSink snbt_sink);
|
完整的 Actor::save NBT,以 SNBT 给出。
- 调用形式:
api->actor_snapshot(id, ctx, snbt_sink)
- 参数:
- id :
PierActorId
- ctx :
void*
- snbt_sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 33 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_num
| C |
|---|
| bool (*actor_get_num)(PierActorId id, int32_t prop, double* out);
|
- 调用形式:
api->actor_get_num(id, prop, out)
- 参数:
- id :
PierActorId
- prop :
int32_t
- out :
double*
- 返回值类型:
bool
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 34 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_str
| C |
|---|
| bool (*actor_get_str)(PierActorId id, int32_t prop, void* ctx, PierStrSink sink);
|
- 调用形式:
api->actor_get_str(id, prop, ctx, sink)
- 参数:
- id :
PierActorId
- prop :
int32_t
- ctx :
void*
- sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 35 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_action
| C |
|---|
| bool (*actor_action)(
PierActorId id,
int32_t action,
PierStr sarg,
double a,
double b,
double c,
void* ctx,
PierStrSink out
);
|
- 调用形式:
api->actor_action(id, action, sarg, a, b, c, ctx, out)
- 参数:
- id :
PierActorId
- action :
int32_t
- sarg :
PierStr
- a :
double
- b :
double
- c :
double
- ctx :
void*
- out :
PierStrSink
- 返回值类型:
bool
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 36 个槽位(从 0 数起)
- 各绑定里的调用方:
spawn_mob
| C |
|---|
| bool (*spawn_mob)(int32_t dim, PierStr type_name, double x, double y, double z, PierActorId* out);
|
生成一个生物(Spawner::spawnMob);成功时 *out 是它的 ActorUniqueID。
- 调用形式:
api->spawn_mob(dim, type_name, x, y, z, out)
- 参数:
- dim :
int32_t
- type_name :
PierStr
- x :
double
- y :
double
- z :
double
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:§C 实体(玩家也可以经
player_resolve 解析到这里)(§C actors (players resolve here too, via player_resolve))
- 表内序号:第 37 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_vehicle
| C |
|---|
| bool (*actor_get_vehicle)(PierActorId id, PierActorId* out);
|
- 调用形式:
api->actor_get_vehicle(id, out)
- 参数:
- id :
PierActorId
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 109 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_first_passenger
| C |
|---|
| bool (*actor_get_first_passenger)(PierActorId id, PierActorId* out);
|
- 调用形式:
api->actor_get_first_passenger(id, out)
- 参数:
- id :
PierActorId
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 110 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_owner
| C |
|---|
| bool (*actor_get_owner)(PierActorId id, PierActorId* out);
|
- 调用形式:
api->actor_get_owner(id, out)
- 参数:
- id :
PierActorId
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 111 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_target
| C |
|---|
| bool (*actor_get_target)(PierActorId id, PierActorId* out);
|
- 调用形式:
api->actor_get_target(id, out)
- 参数:
- id :
PierActorId
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 112 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_equipped_item
| C |
|---|
| bool (*actor_get_equipped_item)(PierActorId id, int32_t slot, void* ctx, PierStrSink sink);
|
slot:0=主手,1=副手,2=头盔,3=胸甲,4=护腿,5=靴子
- 调用形式:
api->actor_get_equipped_item(id, slot, ctx, sink)
- 参数:
- id :
PierActorId
- slot :
int32_t
- ctx :
void*
- sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 113 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_set_equipped_item
| C |
|---|
| bool (*actor_set_equipped_item)(PierActorId id, int32_t slot, PierStr item_snbt);
|
- 调用形式:
api->actor_set_equipped_item(id, slot, item_snbt)
- 参数:
- id :
PierActorId
- slot :
int32_t
- item_snbt :
PierStr
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 114 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_effects
| C |
|---|
| bool (*actor_get_effects)(PierActorId id, void* ctx, PierStrSink sink);
|
SNBT [{id, ticks, amplifier, visible},…]
- 调用形式:
api->actor_get_effects(id, ctx, sink)
- 参数:
- id :
PierActorId
- ctx :
void*
- sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 115 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_status_flag
| C |
|---|
| bool (*actor_get_status_flag)(PierActorId id, int32_t flag_index);
|
flag_index:ActorFlags 枚举的值(从 0 开始)。
- 调用形式:
api->actor_get_status_flag(id, flag_index)
- 参数:
- id :
PierActorId
- flag_index :
int32_t
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 116 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_set_status_flag
| C |
|---|
| bool (*actor_set_status_flag)(PierActorId id, int32_t flag_index, bool value);
|
- 调用形式:
api->actor_set_status_flag(id, flag_index, value)
- 参数:
- id :
PierActorId
- flag_index :
int32_t
- value :
bool
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 117 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_trace_ray
| C |
|---|
| bool (*actor_trace_ray)(PierActorId id, float max_dist, bool include_actors, bool include_blocks, void* ctx,
PierStrSink sink);
|
SNBT {type:"entity"|"block"|"none", pos:[x,y,z], entity_id?, block_name?}
- 调用形式:
api->actor_trace_ray(id, max_dist, include_actors, include_blocks, ctx, sink)
- 参数:
- id :
PierActorId
- max_dist :
float
- include_actors :
bool
- include_blocks :
bool
- ctx :
void*
- sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 118 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_distance_to
| C |
|---|
| bool (*actor_distance_to)(PierActorId id, PierActorId other, double* out);
|
- 调用形式:
api->actor_distance_to(id, other, out)
- 参数:
- id :
PierActorId
- other :
PierActorId
- out :
double*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 119 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_get_aabb
| C |
|---|
| bool (*actor_get_aabb)(PierActorId id, void* ctx, PierStrSink sink);
|
SNBT {min:[x,y,z], max:[x,y,z]}
- 调用形式:
api->actor_get_aabb(id, ctx, sink)
- 参数:
- id :
PierActorId
- ctx :
void*
- sink :
PierStrSink
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 120 个槽位(从 0 数起)
- 各绑定里的调用方:
actor_clone
| C |
|---|
| bool (*actor_clone)(PierActorId id, int32_t dim, double x, double y, double z, PierActorId* out);
|
- 调用形式:
api->actor_clone(id, dim, x, y, z, out)
- 参数:
- id :
PierActorId
- dim :
int32_t
- x :
double
- y :
double
- z :
double
- out :
PierActorId*
- 返回值类型:
bool
- 所在分节:实体:关系、装备、效果、几何(专用函数)(
Actor: relationships, equipment, effects, geometry (dedicated fns))
- 表内序号:第 121 个槽位(从 0 数起)
- 各绑定里的调用方:
PierActorNumProp
actor_get_num / actor_set_num 的键。(S) 表示可以用 actor_set_num 写入。
| 名称 |
值 |
说明 |
PIER_APROP_POS_X |
0 |
(G) Actor::getPosition().x(玩家的脚下位置要用 getFeetPos;POS_* 用的是 getPosition) |
PIER_APROP_POS_Y |
1 |
(G) |
PIER_APROP_POS_Z |
2 |
(G) |
PIER_APROP_ROT_PITCH |
3 |
(G) Actor::getRotation().x |
PIER_APROP_ROT_YAW |
4 |
(G) Actor::getRotation().y |
PIER_APROP_DIMENSION |
5 |
(G) Actor::getDimensionId |
PIER_APROP_HEALTH |
6 |
(G) Actor::getHealth;治疗和伤害用动作完成 |
PIER_APROP_MAX_HEALTH |
7 |
(G) Actor::getMaxHealth |
PIER_APROP_IS_ALIVE |
8 |
(G) Actor::isAlive |
PIER_APROP_IS_ON_GROUND |
9 |
(G) Actor::isOnGround |
PIER_APROP_IS_IN_WATER |
10 |
(G) Actor::isInWater |
PIER_APROP_IS_IN_LAVA |
11 |
(G) Actor::isInLava |
PIER_APROP_IS_ON_FIRE |
12 |
(G) Actor::isOnFire |
PIER_APROP_IS_INVISIBLE |
13 |
(G) Actor::isInvisible |
PIER_APROP_IS_SNEAKING |
14 |
(G) Actor::isSneaking |
PIER_APROP_IS_BABY |
15 |
(G) Actor::isBaby |
PIER_APROP_IS_RIDING |
16 |
(G) Actor::isRiding |
PIER_APROP_IS_TAME |
17 |
(G) Actor::isTame |
PIER_APROP_SPEED |
18 |
(G) Actor::getSpeedInMetersPerSecond |
PIER_APROP_VIEW_X |
19 |
(G) Actor::getViewVector().x |
PIER_APROP_VIEW_Y |
20 |
(G) Actor::getViewVector().y |
PIER_APROP_VIEW_Z |
21 |
(G) Actor::getViewVector().z |
PIER_APROP_VEL_X |
22 |
(G) Actor::getVelocity().x |
PIER_APROP_VEL_Y |
23 |
(G) Actor::getVelocity().y |
PIER_APROP_VEL_Z |
24 |
(G) Actor::getVelocity().z |
PIER_APROP_HEAD_X |
25 |
(G) Actor::getHeadPos().x |
PIER_APROP_HEAD_Y |
26 |
(G) Actor::getHeadPos().y |
PIER_APROP_HEAD_Z |
27 |
(G) Actor::getHeadPos().z |
PIER_APROP_FEET_X |
28 |
(G) Actor::getFeetPos().x |
PIER_APROP_FEET_Y |
29 |
(G) Actor::getFeetPos().y |
PIER_APROP_FEET_Z |
30 |
(G) Actor::getFeetPos().z |
PIER_APROP_FALL_DISTANCE |
31 |
(G) Actor::getFallDistance |
PIER_APROP_IS_PERSISTENT |
32 |
(G) Actor::isPersistent |
PIER_APROP_IS_LEASHED |
33 |
(G) Actor::isLeashed |
PIER_APROP_IS_INVULNERABLE |
34 |
(G) Actor::isInvulnerable |
PIER_APROP_VARIANT |
35 |
(G) Actor::getVariant |
PIER_APROP_MARK_VARIANT |
36 |
(G) Actor::getMarkVariant |
PIER_APROP_SCALE |
37 |
(G) Actor::getScaleFactor |
PIER_APROP_BRIGHTNESS |
38 |
(G) Actor::getBrightness |
PIER_APROP_RADIUS |
39 |
(G) Actor::getRadius |
PIER_APROP_HAS_TOTEM |
40 |
(G) Actor::hasTotemEquipped |
PIER_APROP_IS_IN_RAIN |
41 |
(G) Actor::isInRain |
PIER_APROP_IS_IN_SNOW |
42 |
(G) Actor::isInSnow |
PIER_APROP_IS_IN_THUNDERSTORM |
43 |
(G) Actor::isInThunderstorm |
PIER_APROP_IS_FROZEN |
44 |
(G) Actor::isFrozen |
PIER_APROP_IS_IN_LOVE |
45 |
这个常量在当前的引擎版本上取不到值:(G) 从 BDS 1.26.40 起不再支持:Actor::isInLove 已被移除 |
PIER_APROP_DEATH_TIME |
46 |
(G) Actor::getDeathTime |
PIER_APROP_HAS_PASSENGER |
47 |
(G) Actor::hasPassenger |
PierActorStrProp
actor_get_str 的键。
| 名称 |
值 |
说明 |
PIER_ASTR_TYPE_NAME |
0 |
取自 Actor::getTypeName |
PIER_ASTR_NAME_TAG |
1 |
取自 Actor::getNameTag |
PIER_ASTR_SCORE_TAG |
2 |
取自 Actor::getScoreTag |
PIER_ASTR_FILTERED_NAME |
3 |
取自 Actor::getFilteredNameTag |
PierActorAction
actor_action 的动作。参数是 (sarg, a, b, c);注明了有结果的动作,out 会收到结果。
| 名称 |
值 |
说明 |
PIER_AACT_KILL |
0 |
调用 Actor::kill |
PIER_AACT_DESPAWN |
1 |
调用 Actor::despawn |
PIER_AACT_HEAL |
2 |
a 为治疗量,调用 Actor::heal |
PIER_AACT_SET_ON_FIRE |
3 |
a 为秒数,调用 Actor::setOnFire |
PIER_AACT_TELEPORT |
4 |
a、b、c 为坐标,sarg 为维度("0" 到 "2"),调用 Actor::teleport |
PIER_AACT_SET_NAME_TAG |
5 |
sarg 为名字,调用 Actor::setNameTag |
PIER_AACT_ADD_TAG |
6 |
sarg 为标签,输出 "0" 或 "1",调用 Actor::addTag |
PIER_AACT_REMOVE_TAG |
7 |
sarg 为标签,输出 "0" 或 "1",调用 Actor::removeTag |
PIER_AACT_HAS_TAG |
8 |
sarg 为标签,输出 "0" 或 "1",调用 Actor::hasTag |
PIER_AACT_ADD_EFFECT |
9 |
sarg 为效果名,a 为刻数,b 为效果等级,c 为是否显示粒子(0 或 1),经 MobEffect::getByName 和 Actor::addEffect 完成 |
PIER_AACT_REMOVE_EFFECT |
10 |
sarg 为效果名,调用 Actor::removeEffect(id) |
PIER_AACT_CLEAR_EFFECTS |
11 |
调用 Actor::removeAllEffects |
PIER_AACT_HURT |
12 |
a 为伤害值(通用伤害来源),调用 Actor::hurt |
PIER_AACT_ATTRIBUTE_GET |
13 |
sarg 为属性名("minecraft:health" 等),输出属性值 |
PIER_AACT_SET_VARIANT |
14 |
a 为变种值,调用 Actor::setVariant |
PIER_AACT_SET_MARK_VARIANT |
15 |
a 为变种值,调用 Actor::setMarkVariant |
PIER_AACT_SET_PERSISTENT |
16 |
调用 Actor::setPersistent |
PIER_AACT_SET_LEASH_HOLDER |
17 |
a 为牵引者的 ActorUniqueID,调用 Actor::setLeashHolder |
PIER_AACT_SET_INVISIBLE |
18 |
a 为 0 或 1,调用 Actor::setInvisible |
PIER_AACT_SET_SNEAKING |
19 |
a 为 0 或 1,调用 Actor::setSneaking |
PIER_AACT_SET_NAME_TAG_VISIBLE |
20 |
a 为 0 或 1,调用 Actor::setNameTagVisible |
PIER_AACT_SET_TARGET |
21 |
a 为目标的 ActorUniqueID,调用 Actor::setTarget |
PIER_AACT_SET_OWNER |
22 |
a 为主人的 ActorUniqueID,调用 Actor::setOwner |
PIER_AACT_BURN |
23 |
a 为伤害值,调用 Actor::burn |
PIER_AACT_STOP_FIRE |
24 |
调用 Actor::extinguishFire |
PIER_AACT_SET_VELOCITY |
25 |
a、b、c 为速度,调用 Actor::setVelocity |
PIER_AACT_APPLY_IMPULSE |
26 |
a、b、c 为冲量,调用 Actor::applyImpulse |
PIER_AACT_SET_SCORE_TAG |
27 |
sarg 为文本,调用 Actor::setScoreTag |
PIER_AACT_SET_SKIN_ID |
28 |
a 为皮肤 id,调用 Actor::setSkinID |
PIER_AACT_SET_STRENGTH |
29 |
a 为强度,调用 Actor::setStrength |
PIER_AACT_REMOVE_ALL_PASSENGERS |
30 |
调用 Actor::removeAllPassengers |
PIER_AACT_EXECUTE_EVENT |
31 |
sarg 为事件名,调用 Actor::executeEvent |
PIER_AACT_SET_ROTATION |
32 |
a 为俯仰角,b 为偏航角,调用 Actor::setRotationWrapped |