跳转至

Zig:方块

BlockAt

Zig
1
2
3
4
5
6
7
pub const BlockAt = struct {
    dim_id: i32,
    pos_x: i32,
    pos_y: i32,
    pos_z: i32,
    // ...
};

一个维度里的一个方块格。

BlockAt.at

Zig
pub fn at(at_dim: i32, at_x: i32, at_y: i32, at_z: i32) BlockAt
  • 参数:
    • at_dim : i32
    • at_x : i32
    • at_y : i32
    • at_z : i32
  • 返回值类型:BlockAt

BlockAt.isAir

Zig
pub fn isAir(self: BlockAt) core.Error!bool

PIER_BPROP_IS_AIR:取自 Block::isAir

BlockAt.data

Zig
pub fn data(self: BlockAt) core.Error!f64

PIER_BPROP_DATA:取自 Block::getData(旧版的数据值)

BlockAt.blockItemId

Zig
pub fn blockItemId(self: BlockAt) core.Error!f64

PIER_BPROP_BLOCK_ITEM_ID:取自 Block::getBlockItemId

BlockAt.isCraftingBlock

Zig
pub fn isCraftingBlock(self: BlockAt) core.Error!bool

PIER_BPROP_IS_CRAFTING_BLOCK:取自 Block::isCraftingBlock

BlockAt.isInteractiveBlock

Zig
pub fn isInteractiveBlock(self: BlockAt) core.Error!bool

PIER_BPROP_IS_INTERACTIVE_BLOCK:取自 Block::isInteractiveBlock

BlockAt.hasBlockEntity

Zig
pub fn hasBlockEntity(self: BlockAt) core.Error!bool

PIER_BPROP_HAS_BLOCK_ENTITY:BlockSource::getBlockEntity(pos) != null

BlockAt.light

Zig
pub fn light(self: BlockAt) core.Error!f64

PIER_BPROP_LIGHT:取自 Block::getLight

BlockAt.lightEmission

Zig
pub fn lightEmission(self: BlockAt) core.Error!f64

PIER_BPROP_LIGHT_EMISSION:取自 Block::getLightEmission

BlockAt.destroySpeed

Zig
pub fn destroySpeed(self: BlockAt) core.Error!f64

PIER_BPROP_DESTROY_SPEED:取自 Block::getDestroySpeed

BlockAt.explosionResistance

Zig
pub fn explosionResistance(self: BlockAt) core.Error!f64

PIER_BPROP_EXPLOSION_RESISTANCE:取自 Block::getExplosionResistance

BlockAt.friction

Zig
pub fn friction(self: BlockAt) core.Error!f64

PIER_BPROP_FRICTION:取自 Block::getFriction

BlockAt.isContainer

Zig
pub fn isContainer(self: BlockAt) core.Error!bool

PIER_BPROP_IS_CONTAINER:取自 Block::isContainerBlock

BlockAt.isDoor

Zig
pub fn isDoor(self: BlockAt) core.Error!bool

PIER_BPROP_IS_DOOR:从 BDS 1.26.40 起不再支持:BlockType::isDoorBlock 已被移除

BlockAt.isFence

Zig
pub fn isFence(self: BlockAt) core.Error!bool

PIER_BPROP_IS_FENCE:取自 Block::isFenceBlock

BlockAt.isRail

Zig
pub fn isRail(self: BlockAt) core.Error!bool

PIER_BPROP_IS_RAIL:取自 Block::isRailBlock

BlockAt.isSlab

Zig
pub fn isSlab(self: BlockAt) core.Error!bool

PIER_BPROP_IS_SLAB:取自 Block::isSlabBlock

BlockAt.isStair

Zig
pub fn isStair(self: BlockAt) core.Error!bool

PIER_BPROP_IS_STAIR:从 BDS 1.26.40 起不再支持:BlockType::isStairBlock 已被移除

BlockAt.isWall

Zig
pub fn isWall(self: BlockAt) core.Error!bool

PIER_BPROP_IS_WALL:取自 Block::isWallBlock

BlockAt.isCrop

Zig
pub fn isCrop(self: BlockAt) core.Error!bool

PIER_BPROP_IS_CROP:取自 Block::isCropBlock

BlockAt.isUnbreakable

Zig
pub fn isUnbreakable(self: BlockAt) core.Error!bool

PIER_BPROP_IS_UNBREAKABLE:取自 Block::isUnbreakable

BlockAt.redstoneSignal

Zig
pub fn redstoneSignal(self: BlockAt) core.Error!f64

PIER_BPROP_REDSTONE_SIGNAL:取自 Block::getDirectSignal

BlockAt.comparatorSignal

Zig
pub fn comparatorSignal(self: BlockAt) core.Error!f64

PIER_BPROP_COMPARATOR_SIGNAL:取自 Block::getComparatorSignal

BlockAt.isSignalSource

Zig
pub fn isSignalSource(self: BlockAt) core.Error!bool

PIER_BPROP_IS_SIGNAL_SOURCE:取自 Block::isSignalSource

BlockAt.variant

Zig
pub fn variant(self: BlockAt) core.Error!f64

PIER_BPROP_VARIANT:取自 Block::getVariant

BlockAt.burnOdds

Zig
pub fn burnOdds(self: BlockAt) core.Error!f64

PIER_BPROP_BURN_ODDS:取自 Block::getBurnOdds

BlockAt.flameOdds

Zig
pub fn flameOdds(self: BlockAt) core.Error!f64

PIER_BPROP_FLAME_ODDS:取自 Block::getFlameOdds

BlockAt.bounciness

Zig
pub fn bounciness(self: BlockAt) core.Error!f64

PIER_BPROP_BOUNCINESS:取自 Block::getBounciness

BlockAt.isSolid

Zig
pub fn isSolid(self: BlockAt) core.Error!bool

PIER_BPROP_IS_SOLID:取自 Block::isSolid

BlockAt.requiresTool

Zig
pub fn requiresTool(self: BlockAt) core.Error!f64

PIER_BPROP_REQUIRES_TOOL:取自 Block::requiresCorrectToolForDrops

BlockAt.typeName

Zig
pub fn typeName(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_TYPE_NAME:取自 Block::getTypeName

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.snbt

Zig
pub fn snbt(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_SNBT:取自 Block::mSerializationId,以 SNBT {name,states,version} 给出

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.descriptionId

Zig
pub fn descriptionId(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_DESCRIPTION_ID:取自 Block::getDescriptionId

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.debugString

Zig
pub fn debugString(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_DEBUG_STRING:取自 Block::toDebugString

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.tags

Zig
pub fn tags(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_TAGS:取自 Block::mTags,以 SNBT 字符串列表 ["a","b"] 给出

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.state

Zig
pub fn state(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_STATE:SNBT {state_name:value,…},全部方块状态

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.collisionShape

Zig
pub fn collisionShape(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_COLLISION_SHAPE:SNBT [{min:[x,y,z],max:[x,y,z]},…]

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.outlineShape

Zig
pub fn outlineShape(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_OUTLINE_SHAPE:SNBT [{min,max}],渲染用的轮廓

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.displayName

Zig
pub fn displayName(self: BlockAt, allocator: std.mem.Allocator) core.Error![]u8

PIER_BSTR_DISPLAY_NAME:取自 Block::getDisplayName

  • 参数:
    • allocator : std.mem.Allocator
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_get_str

BlockAt.hasTag

Zig
pub fn hasTag(self: BlockAt, allocator: std.mem.Allocator, s_arg: []const u8) core.Error![]u8

PIER_BACT_HAS_TAG:sarg 为标签,输出 "0" 或 "1",调用 Block::hasTag

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • allocator : std.mem.Allocator
    • s_arg : []const u8
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_action

BlockAt.getState

Zig
pub fn getState(self: BlockAt, allocator: std.mem.Allocator, s_arg: []const u8) core.Error![]u8

PIER_BACT_GET_STATE:sarg 为状态名,输出状态值的字符串,调用 Block::getState

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • allocator : std.mem.Allocator
    • s_arg : []const u8
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_action

BlockAt.popResource

Zig
pub fn popResource(self: BlockAt, allocator: std.mem.Allocator, s_arg: []const u8) core.Error![]u8

PIER_BACT_POP_RESOURCE:sarg 为物品 SNBT,在这个位置掉落该物品,调用 Block::popResource

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • allocator : std.mem.Allocator
    • s_arg : []const u8
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_action

BlockAt.asItem

Zig
pub fn asItem(self: BlockAt, allocator: std.mem.Allocator, s_arg: []const u8) core.Error![]u8

PIER_BACT_AS_ITEM:输出物品 SNBT,调用 Block::asItemInstance

这个动作有输出时,输出就是返回值;每个参数的含义写在 abi.h 里这个常量的注释中。

  • 参数:
    • allocator : std.mem.Allocator
    • s_arg : []const u8
  • 返回值类型:core.Error![]u8
  • 对应槽位:block_action