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§
Sourcefn set_entity_id(&self, entity_type: EntityTypeRef)
fn set_entity_id(&self, entity_type: EntityTypeRef)
Sets the next spawn entity type.
Sourcefn set_entity_data(&self, entity_data: &EntityData)
fn set_entity_data(&self, entity_data: &EntityData)
Sets the next spawn entity type and merges the rest of entity_data into it.
Sourcefn spawn_delay(&self) -> i32
fn spawn_delay(&self) -> i32
Returns the ticks left until the next spawn cycle.
Sourcefn set_spawn_delay(&self, delay: i32)
fn set_spawn_delay(&self, delay: i32)
Sets the ticks left until the next spawn cycle.
Sourcefn config(&self) -> BaseSpawnerConfig
fn config(&self) -> BaseSpawnerConfig
Returns the spawn-cycle limits.
Sourcefn set_config(&self, config: BaseSpawnerConfig)
fn set_config(&self, config: BaseSpawnerConfig)
Replaces the spawn-cycle limits.
Sourcefn spawn_potentials(&self) -> Vec<WeightedSpawnData>
fn spawn_potentials(&self) -> Vec<WeightedSpawnData>
Returns the weighted entries the next spawn data is picked from.
Sourcefn set_spawn_potentials(&self, potentials: Vec<WeightedSpawnData>)
fn set_spawn_potentials(&self, potentials: Vec<WeightedSpawnData>)
Replaces the weighted entries the next spawn data is picked from.
Sourcefn next_spawn_data(&self) -> Option<SpawnData>
fn next_spawn_data(&self) -> Option<SpawnData>
Returns the active spawn data, if one has been selected.
Sourcefn set_next_spawn_data(&self, data: SpawnData)
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".