跳转至

方块

abi.h 里的分节说明

§D 方块与方块实体(§D blocks & block entities)

方块:读写状态、碰撞形状(专用函数)(Block: state get/set, collision shape (dedicated fns))

槽位

block_get_num

C
bool (*block_get_num)(int32_t dim, int32_t x, int32_t y, int32_t z, int32_t prop, double* out);

block_get_str

C
bool (*block_get_str)(int32_t dim, int32_t x, int32_t y, int32_t z, int32_t prop, void* ctx, PierStrSink sink);

block_action

C
bool (*block_action)(
    int32_t dim,
    int32_t x,
    int32_t y,
    int32_t z,
    int32_t action,
    PierStr sarg,
    void* ctx,
    PierStrSink out
);

block_entity_snbt

C
bool (*block_entity_snbt)(int32_t dim, int32_t x, int32_t y, int32_t z, void* ctx, PierStrSink sink);

BlockActor::save(使用默认的 SaveContext)的结果,以 SNBT 给出;那个位置没有方块实体时返回 false。

  • 调用形式:api->block_entity_snbt(dim, x, y, z, ctx, sink)
  • 参数:
    • dim : int32_t
    • x : int32_t
    • y : int32_t
    • z : int32_t
    • ctx : void*
    • sink : PierStrSink
  • 返回值类型:bool
  • 所在分节:§D 方块与方块实体(§D blocks & block entities)
  • 表内序号:第 42 个槽位(从 0 数起)
  • 各绑定里的调用方:

block_get_state

C
bool (*block_get_state)(int32_t dim, int32_t x, int32_t y, int32_t z, PierStr state_name, void* ctx,
                        PierStrSink sink);
  • 调用形式:api->block_get_state(dim, x, y, z, state_name, ctx, sink)
  • 参数:
    • dim : int32_t
    • x : int32_t
    • y : int32_t
    • z : int32_t
    • state_name : PierStr
    • ctx : void*
    • sink : PierStrSink
  • 返回值类型:bool
  • 所在分节:方块:读写状态、碰撞形状(专用函数)(Block: state get/set, collision shape (dedicated fns))
  • 表内序号:第 122 个槽位(从 0 数起)
  • 各绑定里的调用方:

block_set_state

C
bool (*block_set_state)(int32_t dim, int32_t x, int32_t y, int32_t z, PierStr state_name, PierStr value);
  • 调用形式:api->block_set_state(dim, x, y, z, state_name, value)
  • 参数:
    • dim : int32_t
    • x : int32_t
    • y : int32_t
    • z : int32_t
    • state_name : PierStr
    • value : PierStr
  • 返回值类型:bool
  • 所在分节:方块:读写状态、碰撞形状(专用函数)(Block: state get/set, collision shape (dedicated fns))
  • 表内序号:第 123 个槽位(从 0 数起)
  • 各绑定里的调用方:

block_get_collision_shape

C
bool (*block_get_collision_shape)(int32_t dim, int32_t x, int32_t y, int32_t z, void* ctx, PierStrSink sink);
  • 调用形式:api->block_get_collision_shape(dim, x, y, z, ctx, sink)
  • 参数:
    • dim : int32_t
    • x : int32_t
    • y : int32_t
    • z : int32_t
    • ctx : void*
    • sink : PierStrSink
  • 返回值类型:bool
  • 所在分节:方块:读写状态、碰撞形状(专用函数)(Block: state get/set, collision shape (dedicated fns))
  • 表内序号:第 124 个槽位(从 0 数起)
  • 各绑定里的调用方:

PierBlockNumProp

block_get_num 的键。

名称 值 说明
PIER_BPROP_IS_AIR 0 取自 Block::isAir
PIER_BPROP_DATA 1 取自 Block::getData(旧版的数据值)
PIER_BPROP_BLOCK_ITEM_ID 2 取自 Block::getBlockItemId
PIER_BPROP_IS_CRAFTING_BLOCK 3 取自 Block::isCraftingBlock
PIER_BPROP_IS_INTERACTIVE_BLOCK 4 取自 Block::isInteractiveBlock
PIER_BPROP_HAS_BLOCK_ENTITY 5 BlockSource::getBlockEntity(pos) != null
PIER_BPROP_LIGHT 6 取自 Block::getLight
PIER_BPROP_LIGHT_EMISSION 7 取自 Block::getLightEmission
PIER_BPROP_DESTROY_SPEED 8 取自 Block::getDestroySpeed
PIER_BPROP_EXPLOSION_RESISTANCE 9 取自 Block::getExplosionResistance
PIER_BPROP_FRICTION 10 取自 Block::getFriction
PIER_BPROP_IS_CONTAINER 11 取自 Block::isContainerBlock
PIER_BPROP_IS_DOOR 12 这个常量在当前的引擎版本上取不到值:从 BDS 1.26.40 起不再支持:BlockType::isDoorBlock 已被移除
PIER_BPROP_IS_FENCE 13 取自 Block::isFenceBlock
PIER_BPROP_IS_RAIL 14 取自 Block::isRailBlock
PIER_BPROP_IS_SLAB 15 取自 Block::isSlabBlock
PIER_BPROP_IS_STAIR 16 这个常量在当前的引擎版本上取不到值:从 BDS 1.26.40 起不再支持:BlockType::isStairBlock 已被移除
PIER_BPROP_IS_WALL 17 取自 Block::isWallBlock
PIER_BPROP_IS_CROP 18 取自 Block::isCropBlock
PIER_BPROP_IS_UNBREAKABLE 19 取自 Block::isUnbreakable
PIER_BPROP_REDSTONE_SIGNAL 20 取自 Block::getDirectSignal
PIER_BPROP_COMPARATOR_SIGNAL 21 取自 Block::getComparatorSignal
PIER_BPROP_IS_SIGNAL_SOURCE 22 取自 Block::isSignalSource
PIER_BPROP_VARIANT 23 取自 Block::getVariant
PIER_BPROP_BURN_ODDS 24 取自 Block::getBurnOdds
PIER_BPROP_FLAME_ODDS 25 取自 Block::getFlameOdds
PIER_BPROP_BOUNCINESS 26 取自 Block::getBounciness
PIER_BPROP_IS_SOLID 27 取自 Block::isSolid
PIER_BPROP_REQUIRES_TOOL 28 取自 Block::requiresCorrectToolForDrops

PierBlockStrProp

block_get_str 的键。

名称 值 说明
PIER_BSTR_TYPE_NAME 0 取自 Block::getTypeName
PIER_BSTR_SNBT 1 取自 Block::mSerializationId,以 SNBT {name,states,version} 给出
PIER_BSTR_DESCRIPTION_ID 2 取自 Block::getDescriptionId
PIER_BSTR_DEBUG_STRING 3 取自 Block::toDebugString
PIER_BSTR_TAGS 4 取自 Block::mTags,以 SNBT 字符串列表 ["a","b"] 给出
PIER_BSTR_STATE 5 SNBT {state_name:value,…},全部方块状态
PIER_BSTR_COLLISION_SHAPE 6 SNBT [{min:[x,y,z],max:[x,y,z]},…]
PIER_BSTR_OUTLINE_SHAPE 7 SNBT [{min,max}],渲染用的轮廓
PIER_BSTR_DISPLAY_NAME 8 取自 Block::getDisplayName

PierBlockAction

block_action 的动作。

名称 值 说明
PIER_BACT_HAS_TAG 0 sarg 为标签,输出 "0" 或 "1",调用 Block::hasTag
PIER_BACT_GET_STATE 1 sarg 为状态名,输出状态值的字符串,调用 Block::getState
PIER_BACT_POP_RESOURCE 2 sarg 为物品 SNBT,在这个位置掉落该物品,调用 Block::popResource
PIER_BACT_AS_ITEM 3 输出物品 SNBT,调用 Block::asItemInstance