Skip to main content

RenderAssets

Trait RenderAssets 

pub trait RenderAssets {
    // Provided methods
    fn model(&self, id: &Identifier) -> Result<ModelRef, ModelError> { ... }
    fn render_pipeline(
        &self,
        id: &Identifier,
    ) -> Result<RenderPipelineRef, RenderPipelineError> { ... }
    fn animation(&self, id: &Identifier) -> Option<AnimationHolder> { ... }
}
Expand description

The render_assets service, reached through its host.

Provided Methods§

fn model(&self, id: &Identifier) -> Result<ModelRef, ModelError>

Side: client. Published asset/data read: available in Setup, Reloading and World. Resolve a registered standalone model once in client_setup and again in client_resources_reloaded, not each frame. Resource-pack overrides and other namespaces use the normal shared model store; no resource is read or baked here.

fn render_pipeline( &self, id: &Identifier, ) -> Result<RenderPipelineRef, RenderPipelineError>

Side: client. Published asset/data read: available in Setup, Reloading and World. Resolve a pipeline registered in register_render_pipelines once in client_setup and again in client_resources_reloaded, not each frame. Unknown for an id no mod registered, Invalid for one whose shader the current resources don’t give or that didn’t compile. Nothing is read or compiled here.

fn animation(&self, id: &Identifier) -> Option<AnimationHolder>

Side: client. Published asset/data read: available in Setup, Reloading and World. The keyframe animation id, from assets/<namespace>/neoforge/animations/entity/<path>.json in the mod’s or a pack’s resources (NeoForge’s Model.getAnimation), as the latest resource load read it; None when no file gives it or the file failed to load. Get and AnimationHolder::bake it once in client_setup and again in client_resources_reloaded, not each frame.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§