Skip to main content

SpawnPlacementsRegistrar

Trait SpawnPlacementsRegistrar 

pub trait SpawnPlacementsRegistrar {
    // Required method
    fn declare_spawn_placement(
        &mut self,
        path: &str,
        rule: SpawnPlacementRule,
    ) -> Result<(), SpawnPlacementError>;
}
Expand description

Registrar operations for spawn placements.

Required Methods§

fn declare_spawn_placement( &mut self, path: &str, rule: SpawnPlacementRule, ) -> Result<(), SpawnPlacementError>

Declare where the mod’s entity type path may spawn (NeoForge’s RegisterSpawnPlacementsEvent): its placement type, heightmap and a rule of a ground block tag, light and biome tag. The vanilla spawn rules (SpawnPlacements.isSpawnPositionOk and checkSpawnRules) then answer from the rule for the type, wherever the game checks a spawn: natural spawning, chunk generation, spawners, patrols, sieges and reinforcements. Code that must decide per check is the separate mob_spawn_placement_check hook, which still hears the rule’s answer.

Resolved once, at load: an id outside the mod’s manifest-owned namespaces, a tag that is not a namespaced name or a second declaration of the same type refuses the mods, naming the mod; a type no content file defines refuses the resource load, naming the type.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§