Struct voxelize::Registry

source ·
pub struct Registry {
    pub ranges: HashMap<String, UV>,
    pub blocks_by_name: HashMap<String, Block>,
    pub blocks_by_id: HashMap<u32, Block>,
    pub textures: HashSet<String>,
    /* private fields */
}
Expand description

A collection of blocks to use in a Voxelize server. One server has one registry and one registry only. Once a registry is added to a server, it cannot be changed.

Fields

ranges: HashMap<String, UV>

A map of the UV’s to the block faces on the texture atlas.

blocks_by_name: HashMap<String, Block>

Block records, name -> Block.

blocks_by_id: HashMap<u32, Block>

Block records, id -> Block.

textures: HashSet<String>

List of textures that this registry has. Textures are then applied onto block sides.

Implementations

Create a registry instance. By default, the “Air” block is registered at ID of 0.

Generate the UV coordinates of the blocks. Call this before the server starts!

Register multiple blocks into this world. The block ID’s are assigned to the length of the blocks at registration.

Register a block into this world. The block ID is assigned to the length of the blocks registered.

Get a block reference by block name.

Get a block reference by block ID.

Get a block id by block name.

Get block fluidity by id.

Get block fluidity by name.

Get block opacity by id.

Get block opacity by name.

Get block emptiness by id.

Get block emptiness by name.

Get block faces by id.

Get block faces by name.

Get block UV by id.

Get block UV by name.

Check if block is air by id.

Check if block is fluid by id.

Get type map of all blocks.

Logic for checking max height, returning true if id counts as valid max height.

Check if registry contains type.

Get UV map by block.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Tries to create the default.
Calls try_default and panics on an error case.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more