跳到主要内容

ℹ️ 属性

类型

提示

所有属性类型都可以通过可选的 default 指定默认值。

boolean

boolean 类型的属性只有两种可能的值:truefalse

properties:
happy:
type: boolean
default: false

int

int 类型的属性可以取指定范围内的任何整数值。

properties:
mode:
type: int
default: 1
range: 1~3

string

string 类型的属性只能从预定义的选项集合中取值。

properties:
color:
type: string
default: red
values:
- red
- green
- blue

direction

east, south, west, north, up, down

properties:
facing:
type: direction
default: north
values: # 可选
- north
- east
- south
- west
- up
- down

horizontal_direction

east, south, west, north

properties:
facing:
type: horizontal_direction
default: north
values: # 可选
- north
- south
- west
- east

axis

x, y, z

properties:
axis:
type: axis
default: y
values: # 可选
- x
- y
- z

single_block_half

top, bottom

properties:
half:
type: single_block_half
default: bottom
values: # 可选
- top
- bottom

double_block_half

upper, lower

properties:
half:
type: double_block_half
default: lower
values: # 可选
- upper
- lower

hinge

left, right

properties:
hinge:
type: hinge
default: left
values: # 可选
- left
- right

slab_type

top, bottom, double

properties:
type:
type: slab_type
default: bottom
values: # 可选
- top
- bottom
- double

stairs_shape

straight, inner_left, inner_right, outer_left, outer_right

properties:
shape:
type: stairs_shape
default: straight
values: # 可选
- straight
- inner_left
- inner_right
- outer_left
- outer_right

sofa_shape

straight, inner_left, inner_right

properties:
shape:
type: sofa_shape
default: straight
values: # 可选
- straight
- inner_left
- inner_right

anchor_type

floor, wall, ceiling

properties:
face:
type: anchor_type
default: floor
values: # 可选
- floor
- wall
- ceiling

硬编码名称

信息

除下列硬编码名称外,部分属性名由方块行为决定。例如,树苗行为要求存在名为 stage 的属性。

axis

根据放置时点击的方块面自动确定轴向。

properties:
axis:
type: axis
default: y
values: # 可选
- x
- y
- z

waterlogged

waterlogged 决定方块能否含水。

注意

使用 waterlogged 时,请确保对应的视觉方块状态也处于含水状态,否则客户端无法正确渲染水体。

properties:
waterlogged:
type: boolean
default: false

facing

使用此属性名后,方块会在放置时自动匹配朝向。

properties:
facing:
type: direction
default: north
values: # 可选
- north
- east
- south
- west
- up
- down

facing_clockwise

facing 相比,此属性会让放置朝向额外旋转 90 度。

properties:
facing_clockwise:
type: horizontal_direction
default: north
values: # 可选
- north
- south
- west
- east

rotation

提供更精细的旋转角度。

properties:
rotation:
type: int
default: 0
range: 0~7
properties:
rotation:
type: int
default: 0
range: 0~15