Skip to main content

Spawner

Trait Spawner 

Source
pub trait Spawner {
    // Required methods
    fn set_entity_id(&self, entity_type: EntityTypeRef);
    fn set_entity_data(&self, entity_data: &EntityData);
    fn spawn_delay(&self) -> i32;
    fn set_spawn_delay(&self, delay: i32);
    fn config(&self) -> BaseSpawnerConfig;
    fn set_config(&self, config: BaseSpawnerConfig);
    fn spawn_potentials(&self) -> Vec<WeightedSpawnData>;
    fn set_spawn_potentials(&self, potentials: Vec<WeightedSpawnData>);
    fn next_spawn_data(&self) -> Option<SpawnData>;
    fn set_next_spawn_data(&self, data: SpawnData);
}
Expand description

Capability implemented by normal spawner block entities.

Required Methods§

Source

fn set_entity_id(&self, entity_type: EntityTypeRef)

Sets the next spawn entity type.

Source

fn set_entity_data(&self, entity_data: &EntityData)

Sets the next spawn entity type and merges the rest of entity_data into it.

Source

fn spawn_delay(&self) -> i32

Returns the ticks left until the next spawn cycle.

Source

fn set_spawn_delay(&self, delay: i32)

Sets the ticks left until the next spawn cycle.

Source

fn config(&self) -> BaseSpawnerConfig

Returns the spawn-cycle limits.

Source

fn set_config(&self, config: BaseSpawnerConfig)

Replaces the spawn-cycle limits.

Source

fn spawn_potentials(&self) -> Vec<WeightedSpawnData>

Returns the weighted entries the next spawn data is picked from.

Source

fn set_spawn_potentials(&self, potentials: Vec<WeightedSpawnData>)

Replaces the weighted entries the next spawn data is picked from.

Source

fn next_spawn_data(&self) -> Option<SpawnData>

Returns the active spawn data, if one has been selected.

Source

fn set_next_spawn_data(&self, data: SpawnData)

Replaces the active spawn data.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§