Skip to main content

StructureTemplate

Struct StructureTemplate 

Source
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

Source

pub(crate) fn load_vanilla( registry: &Registry, key: &Identifier, ) -> Result<Self, String>

Source

pub(super) fn load_gzip_nbt( registry: &Registry, bytes: &[u8], context: &str, ) -> Result<Self, String>

Source

pub(super) fn read_vec3( list: Option<BorrowedNbtList<'_, '_>>, context: &str, field: &str, ) -> Result<IVec3, String>

Source

pub(super) fn read_vec3d( list: Option<BorrowedNbtList<'_, '_>>, context: &str, field: &str, ) -> Result<DVec3, String>

Source

pub(super) fn read_palettes( registry: &Registry, compound: &BorrowedNbtCompound<'_, '_>, context: &str, ) -> Result<Vec<Vec<BlockStateId>>, String>

Source

pub(super) fn read_palette( registry: &Registry, entries: &BorrowedNbtCompoundList<'_, '_>, context: &str, ) -> Result<Vec<BlockStateId>, String>

Source

pub(super) fn read_blocks( registry: &Registry, blocks: &BorrowedNbtCompoundList<'_, '_>, palette: &[BlockStateId], context: &str, ) -> Result<Vec<StructureBlockInfo>, String>

Source

pub(super) fn read_entities( registry: &Registry, compound: &BorrowedNbtCompound<'_, '_>, context: &str, ) -> Result<Vec<StructureEntityInfo>, String>

Source

pub(super) fn read_entity_rotation( nbt: &BorrowedNbtCompound<'_, '_>, ) -> (f32, f32)

Source

pub(super) fn read_optional_vec3d( nbt: &BorrowedNbtCompound<'_, '_>, field: &str, ) -> DVec3

Source

pub(super) fn read_optional_int( nbt: &BorrowedNbtCompound<'_, '_>, field: &str, ) -> Option<i32>

Source

pub(super) fn read_custom_name( nbt: &BorrowedNbtCompound<'_, '_>, ) -> Option<TextComponent>

Source

pub(super) fn read_entity_tags( nbt: &BorrowedNbtCompound<'_, '_>, ) -> BTreeSet<String>

Source

pub(super) fn strip_entity_base_fields(nbt: &mut NbtCompound)

Source

pub(super) fn is_static_full_block( registry: &Registry, state: BlockStateId, ) -> bool

Source

pub(super) fn sort_block_infos(blocks: &mut [StructureBlockInfo])

Source

pub(crate) const fn size(&self, rotation: Rotation) -> IVec3

Source

pub(crate) const fn zero_position_with_transform( &self, zero_pos: BlockPos, rotation: Rotation, ) -> BlockPos

Source§

impl StructureTemplate

Source

pub(crate) fn bounding_box( &self, pos: BlockPos, rotation: Rotation, ) -> BoundingBox

Source

pub(crate) fn bounding_box_with_transform( &self, position: BlockPos, rotation: Rotation, mirror: StructureMirror, pivot: BlockPos, ) -> BoundingBox

Source

pub(crate) const fn calculate_relative_position( pos: BlockPos, mirror: StructureMirror, rotation: Rotation, pivot: BlockPos, ) -> BlockPos

Source

pub(super) fn transform_entity_position( pos: DVec3, mirror: StructureMirror, rotation: Rotation, pivot: BlockPos, ) -> DVec3

Source

pub(super) fn transform_entity_rotation( (yaw, pitch): (f32, f32), mirror: StructureMirror, rotation: Rotation, ) -> (f32, f32)

Source

pub(super) fn transform_entity_additional_nbt( nbt: &mut NbtCompound, mirror: StructureMirror, rotation: Rotation, )

Source

pub(super) fn entity_facing(nbt: &NbtCompound) -> Option<Direction>

Source

const fn direction_from_entity_facing(value: i32) -> Option<Direction>

Source

pub(super) const fn entity_facing_value(direction: Direction) -> i8

Source

pub(super) fn wrap_degrees(degrees: f32) -> f32

Source

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

Source

pub(super) fn place_entities( &self, region: &mut WorldGenRegion<'_>, position: BlockPos, settings: &StructurePlaceSettings<'_>, )

Source

pub(crate) fn replace_jigsaw_final_states( &self, region: &mut WorldGenRegion<'_>, registry: &Registry, position: BlockPos, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, )

Source

pub(crate) fn data_markers( &self, registry: &Registry, position: BlockPos, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, ) -> Vec<StructureDataMarker>

Source

pub(super) fn update_shape_at_edge( region: &WorldGenRegion<'_>, flags: UpdateFlags, placed_positions: &[BlockPos], min: BlockPos, max: BlockPos, )

Source

pub(super) fn update_from_neighbor_shapes( region: &WorldGenRegion<'_>, state: BlockStateId, pos: BlockPos, ) -> BlockStateId

Source

pub(super) fn fill_neighbor_source_liquids( region: &WorldGenRegion<'_>, to_fill: &mut Vec<BlockPos>, locked_fluids: &[BlockPos], )

Source

pub(super) fn fluid_state_at( region: &WorldGenRegion<'_>, pos: BlockPos, ) -> FluidState

Source

pub(super) fn fluid_state_for_block(state: BlockStateId) -> FluidState

Source

pub(super) fn is_liquid_block_container(state: BlockStateId) -> bool

Source

pub(super) fn place_liquid( region: &WorldGenRegion<'_>, pos: BlockPos, state: BlockStateId, fluid_state: FluidState, ) -> bool

Source

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), )

Source

pub(super) fn palette( &self, settings: &StructurePlaceSettings<'_>, position: BlockPos, random: &mut WorldgenRandom, ) -> Option<&StructureTemplatePalette>

Source

pub(super) fn place_block_entity( region: &mut WorldGenRegion<'_>, pos: BlockPos, state: BlockStateId, block_entity_type: Option<BlockEntityTypeRef>, nbt: NbtCompound, )

Source

pub(super) fn block_entity_type_for_nbt_or_state( registry: &Registry, state: BlockStateId, nbt: &NbtCompound, ) -> Option<BlockEntityTypeRef>

Source

pub(super) fn block_entity_type_for_state( registry: &Registry, state: BlockStateId, ) -> Option<BlockEntityTypeRef>

Source

pub(super) fn should_reseed_template_loot( block_entity_type: Option<BlockEntityTypeRef>, nbt: &NbtCompound, ) -> bool

Source

pub(super) fn is_randomizable_container_block_entity( block_entity_type: BlockEntityTypeRef, ) -> bool

Source§

impl StructureTemplate

Source

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).

Source

pub(super) fn palette_blocks_for_placement<F: FnMut(&StructureBlockInfo, BlockPos)>( blocks: &[StructureBlockInfo], position: BlockPos, settings: &StructurePlaceSettings<'_>, f: F, )

Source

pub(super) const fn transformed_position( position: BlockPos, template_pos: BlockPos, settings: &StructurePlaceSettings<'_>, ) -> BlockPos

Source

pub(super) fn process_block( region: &WorldGenRegion<'_>, registry: &Registry, original: &ProcessedBlockInfo, initial: ProcessedBlockInfo, settings: &StructurePlaceSettings<'_>, reference_pos: BlockPos, random: &mut WorldgenRandom, ) -> Option<ProcessedBlockInfo>

Source

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>

Source

pub(super) fn process_block_age( registry: &Registry, current: ProcessedBlockInfo, mossiness: f32, settings: &StructurePlaceSettings<'_>, random: &mut WorldgenRandom, ) -> ProcessedBlockInfo

Source

pub(super) fn process_block_age_with_random( registry: &Registry, current: ProcessedBlockInfo, mossiness: f32, random: &mut impl Random, ) -> ProcessedBlockInfo

Source

pub(super) fn maybe_replace_full_stone_block( registry: &Registry, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>

Source

pub(super) fn maybe_replace_stairs( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>

Source

pub(super) fn maybe_replace_slab( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>

Source

pub(super) fn maybe_replace_wall( registry: &Registry, state: BlockStateId, mossiness: f32, random: &mut impl Random, ) -> Option<BlockStateId>

Source

pub(super) fn maybe_replace_obsidian( registry: &Registry, random: &mut impl Random, ) -> Option<BlockStateId>

Source

pub(super) fn random_facing_stairs( registry: &Registry, block: BlockRef, random: &mut impl Random, ) -> BlockStateId

Source

pub(super) fn process_lava_submerged_block( registry: &Registry, existing_state: BlockStateId, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo

Source

pub(super) fn process_blackstone_replace( registry: &Registry, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo

Source

pub(super) fn blackstone_replacement_block(block: BlockRef) -> Option<BlockRef>

Source

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>

Source

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>

Source

pub(super) fn processor_next_f32( settings: &StructurePlaceSettings<'_>, pos: BlockPos, random: &mut WorldgenRandom, ) -> f32

Source

pub(super) fn capped_processor_random( world_seed: i64, position: BlockPos, ) -> RandomSource

Source

pub(super) fn vanilla_shuffle<T>(items: &mut [T], random: &mut impl Random)

Source

pub(super) fn replace_jigsaw_block( registry: &Registry, current: ProcessedBlockInfo, ) -> Option<ProcessedBlockInfo>

Source

pub(super) fn parse_block_state_string( registry: &Registry, value: &str, ) -> Option<BlockStateId>

Source

pub(super) fn read_block_identifier_prefix(value: &str) -> Option<(&str, &str)>

Source

pub(super) fn read_block_state_properties_prefix(rest: &str) -> Option<&str>

Source

pub(super) fn apply_terrain_matching_projection( region: &WorldGenRegion<'_>, original: &ProcessedBlockInfo, current: ProcessedBlockInfo, ) -> ProcessedBlockInfo

Source

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

Source

pub(super) fn rule_test_matches( registry: &Registry, test: &StructureRuleTestData, state: BlockStateId, random: &mut LegacyRandom, ) -> bool

Source

pub(super) fn pos_rule_test_matches( test: &PosRuleTestData, _template_pos: BlockPos, world_pos: BlockPos, reference_pos: BlockPos, random: &mut LegacyRandom, ) -> bool

Source

pub(super) fn apply_rule( registry: &Registry, rule: &ProcessorRuleData, current: ProcessedBlockInfo, random: &mut LegacyRandom, ) -> ProcessedBlockInfo

Source§

impl StructureTemplate

Source

pub(crate) fn transform_state( registry: &Registry, state: BlockStateId, mirror: StructureMirror, rotation: Rotation, ) -> BlockStateId

Source

pub(super) fn block_for_state( registry: &Registry, state: BlockStateId, ) -> BlockRef

Source

pub(super) fn rotate_string_properties( properties: &mut [(String, String)], rotation: Rotation, )

Source

pub(super) fn mirror_string_properties( properties: &mut [(String, String)], mirror: StructureMirror, )

Source

pub(super) fn parse_direction(value: &str) -> Option<Direction>

Source

pub(super) fn direction_from_property_name(name: &str) -> Direction

Source

pub(super) const fn mirror_direction( direction: Direction, mirror: StructureMirror, ) -> Direction

Source

const fn mirror_rotation_segment( rotation: i32, steps: i32, mirror: StructureMirror, ) -> i32

Source

const fn inverse_rotate_direction( rotation: Rotation, direction: Direction, ) -> Direction

Source

const fn property_name_from_direction( direction: Direction, ) -> Option<&'static str>

Source

pub(super) fn rotate_rail_shape( shape: &str, rotation: Rotation, ) -> Option<&'static str>

Source

pub(super) fn mirror_rail_shape( shape: &str, mirror: StructureMirror, ) -> Option<&'static str>

Source

pub(super) fn parse_stair_shape(shape: &str) -> Option<&'static str>

Source

pub(super) fn mirror_stair_shape( direction: Direction, shape: &str, mirror: StructureMirror, ) -> Option<(Direction, &'static str)>

Source

pub(super) fn block_pos_seed(pos: BlockPos) -> i64

Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructureTemplate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more