Skip to main content

ResourcesHost

Trait ResourcesHost 

pub trait ResourcesHost {
    // Provided method
    fn resource(
        &self,
        pack_type: PackType,
        identifier: &Identifier,
    ) -> Option<Vec<u8>> { ... }
}
Expand description

The host’s methods both sides share of the resources area, implemented by the game and reached through Host.

Provided Methods§

fn resource( &self, pack_type: PackType, identifier: &Identifier, ) -> Option<Vec<u8>>

Side: both. The winning bytes of resource id in pack_type‘s stack, as ResourceManager.getResource answers it: the highest selected pack that supplies the file wins. Client resources are the selected asset packs over the game’s assets; server data is the world’s selected data packs over the game’s and mods’ data, with minecraft:vanilla kept unless disabled. identifier is the resource name without its assets/<namespace>/ or data/<namespace>/ prefix, e.g. minecraft:models/block/stone.json or mymod:machines/furnace.json. Missing, unreadable and files above MAX_RESOURCE_BYTES return None; a client side (or one without that stack) also returns None. This read never reloads packs.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§