gdpc.block_state_tools¶
Utilities for working with orientation-related block states.
You most likely don’t need to use this module directly: block transformations are already handled
by the Block class.
-
AXIS_VALUES =
('x', 'y', 'z')¶ The possible values for the “axis” block state.
-
FACING_VALUES =
('up', 'down', 'north', 'east', 'south', 'west')¶ The possible values for the “facing” block state.
-
ROTATION_VALUES =
('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15')¶ The possible values for the “rotation” block state.
- facingToRotation(facing: str) str¶
Converts
facingto the corresponding “rotation” block state string.
- rotationToFacing(rotation: str) str¶
Converts
rotationto the nearest corresponding “facing” block state string.
- vectorToAxis(vec: Vec3iLike) str¶
Returns the “axis” block state string corresponding to the direction vector
vec.
- axisToVector(axis: str) ivec3¶
Returns the direction vector corresponding to the “axis” block state string
axis.
- vectorToFacing(vec: Vec3iLike) str¶
Returns the “facing” block state string corresponding to the direction vector
vec.
- facingToVector(facing: str) ivec3¶
Returns the direction vector corresponding to the “facing” block state string
facing.
- rotationToVector(rotation: str) ivec3¶
Returns the axis-aligned direction vector corresponding to
rotation.
-
transformFacing(facing: str, rotation: int =
0, flip: Vec3bLike =bvec3(0, 0, 0)) str¶ Returns the transformed “facing” block state string.
Flips first, rotates second.
- rotateRotation(blockStateRotation: str, rotation: int) str¶
Returns the rotated “rotation” block state string.
Yes, this name is confusing.
blockStateRotationdenotes a value of the “rotation” block state, as used by e.g. signs.rotationdenotes a rotation as used by GDPC’s transformation system, so one of {0,1,2,3}. This function name is consistent with the other block state rotation functions.
- flipRotation(rotation: str, flip: Vec3bLike) str¶
Returns the flipped “rotation” block state string.