pub(crate) struct StructureTemplate {
size: IVec3,
palettes: Vec<StructureTemplatePalette>,
entities: Vec<StructureEntityInfo>,
}Expand description
Loaded vanilla structure template payload.
Steel keeps template data separate from template-pool metadata. Pools only need jigsaw
summaries during structure-start planning; feature and piece placement need the full NBT
block payload and processors, so this type mirrors vanilla’s loaded StructureTemplate.
Fields§
§size: IVec3§palettes: Vec<StructureTemplatePalette>§entities: Vec<StructureEntityInfo>Implementations§
Source§impl StructureTemplate
impl StructureTemplate
pub(crate) fn load_vanilla( registry: &Registry, key: &Identifier, ) -> Result<Self, String>
pub(super) fn load_gzip_nbt( registry: &Registry, bytes: &[u8], context: &str, ) -> Result<Self, String>
pub(super) fn read_vec3( list: Option<BorrowedNbtList<'_, '_>>, context: &str, field: &str, ) -> Result<IVec3, String>
pub(super) fn read_vec3d( list: Option<BorrowedNbtList<'_, '_>>, context: &str, field: &str, ) -> Result<DVec3, String>
pub(super) fn read_palettes( registry: &Registry, compound: &BorrowedNbtCompound<'_, '_>, context: &str, ) -> Result<Vec<Vec<BlockStateId>>, String>
pub(super) fn read_palette( registry: &Registry, entries: &BorrowedNbtCompoundList<'_, '_>, context: &str, ) -> Result<Vec<BlockStateId>, String>
pub(super) fn read_blocks( registry: &Registry, blocks: &BorrowedNbtCompoundList<'_, '_>, palette: &[BlockStateId], context: &str, ) -> Result<Vec<StructureBlockInfo>, String>
pub(super) fn read_entities( registry: &Registry, compound: &BorrowedNbtCompound<'_, '_>, context: &str, ) -> Result<Vec<StructureEntityInfo>, String>
pub(super) fn read_entity_rotation( nbt: &BorrowedNbtCompound<'_, '_>, ) -> (f32, f32)
pub(super) fn read_optional_vec3d( nbt: &BorrowedNbtCompound<'_, '_>, field: &str, ) -> DVec3
pub(super) fn read_optional_int( nbt: &BorrowedNbtCompound<'_, '_>, field: &str, ) -> Option<i32>
pub(super) fn read_custom_name( nbt: &BorrowedNbtCompound<'_, '_>, ) -> Option<TextComponent>
pub(super) fn strip_entity_base_fields(nbt: &mut NbtCompound)
pub(super) fn is_static_full_block( registry: &Registry, state: BlockStateId, ) -> bool
pub(super) fn sort_block_infos(blocks: &mut [StructureBlockInfo])
pub(crate) const fn size(&self, rotation: Rotation) -> IVec3
pub(crate) const fn zero_position_with_transform( &self, zero_pos: BlockPos, rotation: Rotation, ) -> BlockPos
Source§impl StructureTemplate
impl StructureTemplate
pub(crate) fn bounding_box( &self, pos: BlockPos, rotation: Rotation, ) -> BoundingBox
pub(crate) fn bounding_box_with_transform( &self, position: BlockPos, rotation: Rotation, mirror: StructureMirror, pivot: BlockPos, ) -> BoundingBox
pub(crate) const fn calculate_relative_position( pos: BlockPos, mirror: StructureMirror, rotation: Rotation, pivot: BlockPos, ) -> BlockPos
pub(super) fn transform_entity_position( pos: DVec3, mirror: StructureMirror, rotation: Rotation, pivot: BlockPos, ) -> DVec3
pub(super) fn transform_entity_rotation( (yaw, pitch): (f32, f32), mirror: StructureMirror, rotation: Rotation, ) -> (f32, f32)
pub(super) fn transform_entity_additional_nbt( nbt: &mut NbtCompound, mirror: StructureMirror, rotation: Rotation, )
pub(super) fn entity_facing(nbt: &NbtCompound) -> Option<Direction>
const fn direction_from_entity_facing(value: i32) -> Option<Direction>
pub(super) const fn entity_facing_value(direction: Direction) -> i8
pub(super) fn wrap_degrees(degrees: f32) -> f32
pub(crate) fn place_in_world( &self, region: &mut WorldGenRegion<'_>, registry: &Registry, position: BlockPos, reference_pos: BlockPos, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, flags: UpdateFlags, ) -> bool
pub(super) fn place_entities( &self, region: &mut WorldGenRegion<'_>, position: BlockPos, settings: &StructurePlaceSettings<'_>, )
pub(crate) fn replace_jigsaw_final_states( &self, region: &mut WorldGenRegion<'_>, registry: &Registry, position: BlockPos, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, )
pub(crate) fn data_markers( &self, registry: &Registry, position: BlockPos, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, ) -> Vec<StructureDataMarker>
pub(super) fn update_shape_at_edge( region: &WorldGenRegion<'_>, flags: UpdateFlags, placed_positions: &[BlockPos], min: BlockPos, max: BlockPos, )
pub(super) fn update_from_neighbor_shapes( region: &WorldGenRegion<'_>, state: BlockStateId, pos: BlockPos, ) -> BlockStateId
pub(super) fn fill_neighbor_source_liquids( region: &WorldGenRegion<'_>, to_fill: &mut Vec<BlockPos>, locked_fluids: &[BlockPos], )
pub(super) fn fluid_state_at( region: &WorldGenRegion<'_>, pos: BlockPos, ) -> FluidState
pub(super) fn fluid_state_for_block(state: BlockStateId) -> FluidState
pub(super) fn is_liquid_block_container(state: BlockStateId) -> bool
pub(super) fn place_liquid( region: &WorldGenRegion<'_>, pos: BlockPos, state: BlockStateId, fluid_state: FluidState, ) -> bool
pub(super) fn for_all_shape_faces( x_size: i32, y_size: i32, z_size: i32, is_full: impl Fn(i32, i32, i32) -> bool, consumer: impl FnMut(Direction, i32, i32, i32), )
pub(super) fn palette( &self, settings: &StructurePlaceSettings<'_>, position: BlockPos, random: &mut WorldgenRandom, ) -> Option<&StructureTemplatePalette>
pub(super) fn place_block_entity( region: &mut WorldGenRegion<'_>, pos: BlockPos, state: BlockStateId, block_entity_type: Option<BlockEntityTypeRef>, nbt: NbtCompound, )
pub(super) fn block_entity_type_for_nbt_or_state( registry: &Registry, state: BlockStateId, nbt: &NbtCompound, ) -> Option<BlockEntityTypeRef>
pub(super) fn block_entity_type_for_state( registry: &Registry, state: BlockStateId, ) -> Option<BlockEntityTypeRef>
pub(super) fn should_reseed_template_loot( block_entity_type: Option<BlockEntityTypeRef>, nbt: &NbtCompound, ) -> bool
pub(super) fn is_randomizable_container_block_entity( block_entity_type: BlockEntityTypeRef, ) -> bool
Source§impl StructureTemplate
impl StructureTemplate
Sourcepub(super) fn pre_filters_placement_bounds(
processors: &[StructureProcessorKind],
) -> bool
pub(super) fn pre_filters_placement_bounds( processors: &[StructureProcessorKind], ) -> bool
StructureLayoutOptimizer: skip out-of-bounds blocks before processors run.
Disabled when a Capped processor is present — it needs the full block list
in finalize_processing (Trail Ruins).
pub(super) fn palette_blocks_for_placement<F: FnMut(&StructureBlockInfo, BlockPos)>( blocks: &[StructureBlockInfo], position: BlockPos, settings: &StructurePlaceSettings<'_>, f: F, )
pub(super) const fn transformed_position( position: BlockPos, template_pos: BlockPos, settings: &StructurePlaceSettings<'_>, ) -> BlockPos
pub(super) fn process_block( region: &WorldGenRegion<'_>, registry: &Registry, original: &ProcessedBlockInfo, initial: ProcessedBlockInfo, settings: &StructurePlaceSettings<'_>, reference_pos: BlockPos, random: &mut WorldgenRandom, ) -> Option<ProcessedBlockInfo>
pub(super) fn process_block_with_processor( region: &WorldGenRegion<'_>, registry: &Registry, processor: &StructureProcessorKind, original: &ProcessedBlockInfo, current: ProcessedBlockInfo, settings: &StructurePlaceSettings<'_>, reference_pos: BlockPos, random: &mut WorldgenRandom, ) -> Option<ProcessedBlockInfo>
pub(super) fn process_block_age( registry: &Registry, current: ProcessedBlockInfo, mossiness: f32, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, ) -> ProcessedBlockInfo
pub(super) fn process_block_age_with_random( registry: &Registry, current: ProcessedBlockInfo, mossiness: f32, random: &mut impl Random, ) -> ProcessedBlockInfo
pub(super) fn maybe_replace_full_stone_block( registry: &Registry, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>
pub(super) fn maybe_replace_stairs( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>
pub(super) fn maybe_replace_slab( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>
pub(super) fn maybe_replace_wall( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>
pub(super) fn maybe_replace_obsidian( registry: &Registry, random: &mut impl Random, ) -> Option<BlockStateId>
pub(super) fn random_facing_stairs( registry: &Registry, block: BlockRef, random: &mut impl Random, ) -> BlockStateId
pub(super) fn process_lava_submerged_block( registry: &Registry, existing_state: BlockStateId, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo
pub(super) fn process_blackstone_replace( registry: &Registry, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo
pub(super) fn blackstone_replacement_block(block: BlockRef) -> Option<BlockRef>
pub(super) fn finalize_processing( region: &WorldGenRegion<'_>, registry: &Registry, position: BlockPos, reference_pos: BlockPos, settings: &StructurePlaceSettings<'_>, original_blocks: &[ProcessedBlockInfo], processed_blocks: Vec<ProcessedBlockInfo>, random: &mut WorldgenRandom, ) -> Vec<ProcessedBlockInfo>
pub(super) fn finalize_capped_processing( region: &WorldGenRegion<'_>, registry: &Registry, position: BlockPos, reference_pos: BlockPos, delegate: &StructureProcessorKind, limit: &IntProvider, original_blocks: &[ProcessedBlockInfo], processed_blocks: Vec<ProcessedBlockInfo>, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, ) -> Vec<ProcessedBlockInfo>
pub(super) fn processor_next_f32( settings: &StructurePlaceSettings<'_>, pos: BlockPos, random: &mut WorldgenRandom, ) -> f32
pub(super) fn capped_processor_random( world_seed: i64, position: BlockPos, ) -> RandomSource
pub(super) fn vanilla_shuffle<T>(items: &mut [T], random: &mut impl Random)
pub(super) fn replace_jigsaw_block( registry: &Registry, current: ProcessedBlockInfo, ) -> Option<ProcessedBlockInfo>
pub(super) fn parse_block_state_string( registry: &Registry, value: &str, ) -> Option<BlockStateId>
pub(super) fn read_block_identifier_prefix(value: &str) -> Option<(&str, &str)>
pub(super) fn read_block_state_properties_prefix(rest: &str) -> Option<&str>
pub(super) fn apply_terrain_matching_projection( region: &WorldGenRegion<'_>, original: &ProcessedBlockInfo, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo
pub(super) fn rule_matches( registry: &Registry, rule: &ProcessorRuleData, input_state: BlockStateId, location_state: BlockStateId, template_pos: BlockPos, world_pos: BlockPos, reference_pos: BlockPos, random: &mut LegacyRandom, ) -> bool
pub(super) fn rule_test_matches( registry: &Registry, test: &StructureRuleTestData, state: BlockStateId, random: &mut LegacyRandom, ) -> bool
pub(super) fn pos_rule_test_matches( test: &PosRuleTestData, _template_pos: BlockPos, world_pos: BlockPos, reference_pos: BlockPos, random: &mut LegacyRandom, ) -> bool
pub(super) fn apply_rule( registry: &Registry, rule: &ProcessorRuleData, current: ProcessedBlockInfo, random: &mut LegacyRandom, ) -> ProcessedBlockInfo
Source§impl StructureTemplate
impl StructureTemplate
pub(crate) fn transform_state( registry: &Registry, state: BlockStateId, mirror: StructureMirror, rotation: Rotation, ) -> BlockStateId
pub(super) fn block_for_state( registry: &Registry, state: BlockStateId, ) -> BlockRef
pub(super) fn rotate_string_properties( properties: &mut [(String, String)], rotation: Rotation, )
pub(super) fn mirror_string_properties( properties: &mut [(String, String)], mirror: StructureMirror, )
pub(super) fn parse_direction(value: &str) -> Option<Direction>
pub(super) fn direction_from_property_name(name: &str) -> Direction
pub(super) const fn mirror_direction( direction: Direction, mirror: StructureMirror, ) -> Direction
const fn mirror_rotation_segment( rotation: i32, steps: i32, mirror: StructureMirror, ) -> i32
const fn inverse_rotate_direction( rotation: Rotation, direction: Direction, ) -> Direction
const fn property_name_from_direction( direction: Direction, ) -> Option<&'static str>
pub(super) fn rotate_rail_shape( shape: &str, rotation: Rotation, ) -> Option<&'static str>
pub(super) fn mirror_rail_shape( shape: &str, mirror: StructureMirror, ) -> Option<&'static str>
pub(super) fn parse_stair_shape(shape: &str) -> Option<&'static str>
pub(super) fn mirror_stair_shape( direction: Direction, shape: &str, mirror: StructureMirror, ) -> Option<(Direction, &'static str)>
pub(super) fn block_pos_seed(pos: BlockPos) -> i64
pub(super) fn clamped_lerp_inverse( value: i32, min_dist: i32, max_dist: i32, min: f32, max: f32, ) -> f32
Trait Implementations§
Source§impl Clone for StructureTemplate
impl Clone for StructureTemplate
Source§fn clone(&self) -> StructureTemplate
fn clone(&self) -> StructureTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StructureTemplate
impl RefUnwindSafe for StructureTemplate
impl Send for StructureTemplate
impl Sync for StructureTemplate
impl Unpin for StructureTemplate
impl UnsafeUnpin for StructureTemplate
impl UnwindSafe for StructureTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>