diff options
| author | mat <git@matdoes.dev> | 2024-11-27 10:26:40 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-11-27 10:26:40 +0000 |
| commit | 0817382098128adcecb77756a3c7cd1bd0066057 (patch) | |
| tree | 623d9b297f9b5fdb2af74ab3c5a4fa5c1b72ff5b /codegen/lib/code/shapes.py | |
| parent | dfdc3144b61b6750ad62fb493b7c00c6c820c90b (diff) | |
| download | azalea-drasl-0817382098128adcecb77756a3c7cd1bd0066057.tar.xz | |
replace once_cell with std:;sync::LazyLock
Diffstat (limited to 'codegen/lib/code/shapes.py')
| -rwxr-xr-x | codegen/lib/code/shapes.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/codegen/lib/code/shapes.py b/codegen/lib/code/shapes.py index b50cdcf1..12b333d1 100755 --- a/codegen/lib/code/shapes.py +++ b/codegen/lib/code/shapes.py @@ -71,7 +71,7 @@ def generate_block_shapes_code(blocks: dict, shapes: dict, block_states_report, generated_shape_code += generate_code_for_shape(shape_id, shape) - # static SHAPES_MAP: [&Lazy<VoxelShape>; 26644] = [&SHAPE0, &SHAPE1, &SHAPE1, ...] + # static SHAPES_MAP: [&LazyLock<VoxelShape>; 26644] = [&SHAPE0, &SHAPE1, &SHAPE1, ...] empty_shapes = [] full_shapes = [] @@ -92,7 +92,7 @@ def generate_block_shapes_code(blocks: dict, shapes: dict, block_states_report, block_state_ids_to_shape_ids.append((block_state_id, shape_id)) - generated_map_code = f'static SHAPES_MAP: [&Lazy<VoxelShape>; {len(block_state_ids_to_shape_ids)}] = [' + generated_map_code = f'static SHAPES_MAP: [&LazyLock<VoxelShape>; {len(block_state_ids_to_shape_ids)}] = [' block_state_ids_to_shape_ids = sorted(block_state_ids_to_shape_ids, key=lambda x: x[0]) @@ -118,7 +118,7 @@ def generate_block_shapes_code(blocks: dict, shapes: dict, block_states_report, use super::VoxelShape; use crate::collision::{{self, Shapes}}; use azalea_block::*; -use once_cell::sync::Lazy; +use std::sync::LazyLock; pub trait BlockWithShape {{ fn shape(&self) -> &'static VoxelShape; @@ -156,7 +156,7 @@ def generate_code_for_shape(shape_id: str, parts: list[list[float]]): def make_arguments(part: list[float]): return ', '.join(map(lambda n: str(n).rstrip('0'), part)) code = '' - code += f'static SHAPE{shape_id}: Lazy<VoxelShape> = Lazy::new(|| {{' + code += f'static SHAPE{shape_id}: LazyLock<VoxelShape> = LazyLock::new(|| {{' steps = [] if parts == (): steps.append('collision::EMPTY_SHAPE.clone()') |
