diff options
Diffstat (limited to 'codegen/lib/code')
| -rwxr-xr-x | codegen/lib/code/shapes.py | 8 | ||||
| -rw-r--r-- | codegen/lib/code/tags.py | 5 |
2 files changed, 6 insertions, 7 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()') diff --git a/codegen/lib/code/tags.py b/codegen/lib/code/tags.py index ae409001..d43b0071 100644 --- a/codegen/lib/code/tags.py +++ b/codegen/lib/code/tags.py @@ -9,8 +9,7 @@ def generate_tags(registries: dict, file_name: str, struct_name: str): generated = f'''// This file was generated by codegen/lib/code/tags.py, don't edit it manually! use std::collections::HashSet; - -use once_cell::sync::Lazy; +use std::sync::LazyLock; use crate::{struct_name}; @@ -19,7 +18,7 @@ use crate::{struct_name}; for tag_name, tag in sorted(registries.items(), key=lambda x: x[0]): tag_name = tag_name.replace('/', '_') static_set_name = to_snake_case(tag_name).upper() - generated += f'pub static {static_set_name}: Lazy<HashSet<{struct_name}>> = Lazy::new(|| HashSet::from_iter(vec![' + generated += f'pub static {static_set_name}: LazyLock<HashSet<{struct_name}>> = LazyLock::new(|| HashSet::from_iter(vec![' queue = tag['values'].copy() while queue != []: |
