Skip to main content

StructurePiece

Trait StructurePiece 

pub trait StructurePiece:
    Debug
    + Send
    + Sync {
    // Required methods
    fn bounding_box(&self) -> BoundingBox;
    fn post_process(
        &self,
        context: &mut dyn PieceContext,
    ) -> Result<(), StructureError>;
    fn add_additional_save_data(&self, tag: &mut BTreeMap<JavaString, Tag>);
}
Expand description

One piece of a mod’s structure: vanilla’s StructurePiece. Its save is the engine’s (StructurePiece.createTag: the type id, BB, O, GD) around add_additional_save_data.

Required Methods§

fn bounding_box(&self) -> BoundingBox

StructurePiece.getBoundingBox: the piece’s box, in world blocks.

fn post_process( &self, context: &mut dyn PieceContext, ) -> Result<(), StructureError>

StructurePiece.postProcess: place the piece’s blocks and entities that fall in the chunk context clips to. Writes outside it are dropped silently, as vanilla’s placeBlock skips them.

fn add_additional_save_data(&self, tag: &mut BTreeMap<JavaString, Tag>)

StructurePiece.addAdditionalSaveData: the piece’s own fields, saved beside BB/O/GD and read back by the type’s load_piece.

Trait Implementations§

§

impl Wire for Box<dyn StructurePiece>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<Box<dyn StructurePiece>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§