utils
position_to_chunk_relative
¶
Python
position_to_chunk_relative(
position: Vector3D[int],
) -> Tuple[Vector2D[int], Vector3D[int], int]
Split absolute world position into chunk, relative block position, and section.
| PARAMETER | DESCRIPTION |
|---|---|
position
|
Absolute world position (x, y, z). |
| RETURNS | DESCRIPTION |
|---|---|
Tuple[Vector2D[int], Vector3D[int], int]
|
Chunk coordinates (chunk_x, chunk_z), Relative position in chunk and section (rel_x, rel_y, rel_z), Section Y coordinate. |
calculate_block_face
¶
Calculate which face of a block the observer is most likely targeting.
| PARAMETER | DESCRIPTION |
|---|---|
observer
|
Observer's current position (usually eye level). |
block
|
Block position (x, y, z). |
| RETURNS | DESCRIPTION |
|---|---|
int
|
Face being targeted: - 0: down - 1: up - 2: north - 3: south - 4: west - 5: east |