pub struct ResourcePack {
pub blockstates: HashMap<String, HashMap<String, BlockstateDefinition>>,
pub models: HashMap<String, HashMap<String, BlockModel>>,
pub textures: HashMap<String, HashMap<String, TextureData>>,
}Expand description
A loaded Minecraft resource pack.
Fields§
§blockstates: HashMap<String, HashMap<String, BlockstateDefinition>>Blockstate definitions by namespace and block ID. Key: namespace (e.g., “minecraft”), Value: map of block_id to definition.
models: HashMap<String, HashMap<String, BlockModel>>Model definitions by namespace and model path. Key: namespace, Value: map of model_path to model.
textures: HashMap<String, HashMap<String, TextureData>>Texture data by namespace and texture path. Key: namespace, Value: map of texture_path to data.
Implementations§
Source§impl ResourcePack
impl ResourcePack
pub fn new() -> Self
Sourcepub fn get_blockstate(
&self,
resource_location: &str,
) -> Option<&BlockstateDefinition>
pub fn get_blockstate( &self, resource_location: &str, ) -> Option<&BlockstateDefinition>
Get a blockstate definition by full resource location (e.g., “minecraft:stone”).
Sourcepub fn get_model(&self, resource_location: &str) -> Option<&BlockModel>
pub fn get_model(&self, resource_location: &str) -> Option<&BlockModel>
Get a model by full resource location (e.g., “minecraft:block/stone”).
Sourcepub fn get_texture(&self, resource_location: &str) -> Option<&TextureData>
pub fn get_texture(&self, resource_location: &str) -> Option<&TextureData>
Get a texture by full resource location (e.g., “minecraft:block/stone”).
Sourcepub fn add_blockstate(
&mut self,
namespace: &str,
block_id: &str,
definition: BlockstateDefinition,
)
pub fn add_blockstate( &mut self, namespace: &str, block_id: &str, definition: BlockstateDefinition, )
Add a blockstate definition.
Sourcepub fn add_model(
&mut self,
namespace: &str,
model_path: &str,
model: BlockModel,
)
pub fn add_model( &mut self, namespace: &str, model_path: &str, model: BlockModel, )
Add a model.
Sourcepub fn add_texture(
&mut self,
namespace: &str,
texture_path: &str,
texture: TextureData,
)
pub fn add_texture( &mut self, namespace: &str, texture_path: &str, texture: TextureData, )
Add a texture.
Sourcepub fn blockstate_count(&self) -> usize
pub fn blockstate_count(&self) -> usize
Get the total number of blockstate definitions.
Sourcepub fn model_count(&self) -> usize
pub fn model_count(&self) -> usize
Get the total number of models.
Sourcepub fn texture_count(&self) -> usize
pub fn texture_count(&self) -> usize
Get the total number of textures.
Sourcepub fn namespaces(&self) -> Vec<&str>
pub fn namespaces(&self) -> Vec<&str>
Get all namespaces in the resource pack.
Trait Implementations§
Source§impl Clone for ResourcePack
impl Clone for ResourcePack
Source§fn clone(&self) -> ResourcePack
fn clone(&self) -> ResourcePack
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more