Botcraft 1.21.4
Loading...
Searching...
No Matches
Botcraft::AssetsManager Class Reference

#include <AssetsManager.hpp>

Public Member Functions

 AssetsManager (AssetsManager const &)=delete
 
void operator= (AssetsManager const &)=delete
 
const std::unordered_map< int, std::unique_ptr< Blockstate > > & Blockstates () const
 
const BlockstateGetBlockstate (const BlockstateId id) const
 
const BlockstateGetBlockstate (const std::string &name) const
 Get the first blockstate found with a given name.
 
const std::unordered_map< int, std::unique_ptr< Biome > > & Biomes () const
 
const BiomeGetBiome (const int id) const
 
const std::unordered_map< ItemId, std::unique_ptr< Item > > & Items () const
 
const ItemGetItem (const ItemId id) const
 
const ItemGetItem (const std::string &item_name) const
 
ItemId GetItemID (const std::string &item_name) const
 
const Renderer::AtlasGetAtlas () const
 

Static Public Member Functions

static AssetsManagergetInstance ()
 

Private Member Functions

 AssetsManager ()
 
void LoadBlocksFile ()
 
void FlattenBlocks ()
 
void LoadBiomesFile ()
 
void LoadItemsFile ()
 
void LoadTextures ()
 
void ClearCaches ()
 
void UpdateModelsWithAtlasData ()
 

Private Attributes

std::unordered_map< int, std::unique_ptr< Blockstate > > blockstates
 
std::vector< const Blockstate * > flattened_blockstates
 
size_t flattened_blockstates_size
 
std::unordered_map< int, std::unique_ptr< Biome > > biomes
 
std::unordered_map< ItemId, std::unique_ptr< Item > > items
 
std::unique_ptr< Renderer::Atlasatlas
 

Detailed Description

Definition at line 19 of file AssetsManager.hpp.

Constructor & Destructor Documentation

◆ AssetsManager() [1/2]

Botcraft::AssetsManager::AssetsManager ( AssetsManager const &  )
delete

◆ AssetsManager() [2/2]

Botcraft::AssetsManager::AssetsManager ( )
private

Member Function Documentation

◆ Biomes()

const std::unordered_map< int, std::unique_ptr< Biome > > & Botcraft::AssetsManager::Biomes ( ) const

Definition at line 136 of file AssetsManager.cpp.

◆ Blockstates()

const std::unordered_map< int, std::unique_ptr< Blockstate > > & Botcraft::AssetsManager::Blockstates ( ) const

Definition at line 62 of file AssetsManager.cpp.

◆ ClearCaches()

void Botcraft::AssetsManager::ClearCaches ( )
private

Definition at line 1097 of file AssetsManager.cpp.

References Botcraft::Model::ClearCache(), and Botcraft::Blockstate::ClearCache().

Referenced by AssetsManager().

◆ FlattenBlocks()

void Botcraft::AssetsManager::FlattenBlocks ( )
private

Definition at line 841 of file AssetsManager.cpp.

References blockstates, flattened_blockstates, flattened_blockstates_size, and LOG_ERROR.

Referenced by LoadBlocksFile().

◆ GetAtlas()

const Renderer::Atlas * Botcraft::AssetsManager::GetAtlas ( ) const

◆ GetBiome()

const Biome * Botcraft::AssetsManager::GetBiome ( const int  id) const

Definition at line 145 of file AssetsManager.cpp.

Referenced by Botcraft::Chunk::GetBiome().

◆ GetBlockstate() [1/2]

const Blockstate * Botcraft::AssetsManager::GetBlockstate ( const BlockstateId  id) const

◆ GetBlockstate() [2/2]

const Blockstate * Botcraft::AssetsManager::GetBlockstate ( const std::string &  name) const

Get the first blockstate found with a given name.

Parameters
nameName of the blockstate
Returns
A blockstate matching the given name, or default block if not found

Definition at line 109 of file AssetsManager.cpp.

References blockstates, flattened_blockstates, and Botcraft::Blockstate::GetName().

◆ getInstance()

◆ GetItem() [1/2]

const Item * Botcraft::AssetsManager::GetItem ( const ItemId  id) const

Definition at line 164 of file AssetsManager.cpp.

References items.

Referenced by Botcraft::DigImpl(), and Botcraft::PhysicsManager::PhysicsManager().

◆ GetItem() [2/2]

const Item * Botcraft::AssetsManager::GetItem ( const std::string &  item_name) const

Definition at line 184 of file AssetsManager.cpp.

References items.

◆ GetItemID()

◆ Items()

const std::unordered_map< ItemId, std::unique_ptr< Item > > & Botcraft::AssetsManager::Items ( ) const

◆ LoadBiomesFile()

◆ LoadBlocksFile()

void Botcraft::AssetsManager::LoadBlocksFile ( )
private

Definition at line 280 of file AssetsManager.cpp.

References Botcraft::BlockstateProperties::air, Botcraft::BlockstateProperties::bed, Botcraft::BlockstateProperties::berry_bush, blockstates, Botcraft::BlockstateProperties::climbable, Botcraft::BlockstateProperties::cobweb, ProtocolCraft::Json::Value::contains(), Botcraft::BlockstateProperties::custom, Botcraft::BlockstateProperties::down_bubble_column, Botcraft::Utilities::EndsWith(), FlattenBlocks(), ProtocolCraft::Json::Value::get(), ProtocolCraft::Json::Value::get_array(), ProtocolCraft::Json::Value::get_object(), ProtocolCraft::Json::Value::get_string(), Botcraft::Model::GetModel(), Botcraft::GetToolMaterialFromString(), Botcraft::GetToolTypeFromString(), Botcraft::Grass, Botcraft::BlockstateProperties::hazardous, Botcraft::BlockstateProperties::honey, Botcraft::BlockstateProperties::id, ProtocolCraft::Json::Value::is_array(), ProtocolCraft::Json::Value::is_object(), Botcraft::BlockstateProperties::lava, Botcraft::Leaves, LOG_ERROR, LOG_WARNING, Botcraft::BestTool::min_material, Botcraft::BestTool::multiplier, Botcraft::None, Botcraft::BlockstateProperties::path, Botcraft::BlockstateProperties::powder_snow, Botcraft::Redstone, Botcraft::BlockstateProperties::scaffolding, Botcraft::Shears, ProtocolCraft::Json::Value::size(), Botcraft::BlockstateProperties::slime, Botcraft::BlockstateProperties::solid, Botcraft::BlockstateProperties::soul_sand, Botcraft::Sword, Botcraft::BlockstateProperties::tint_type, Botcraft::BestTool::tool_type, Botcraft::BlockstateProperties::transparent, Botcraft::BlockstateProperties::up_bubble_column, Botcraft::BlockstateProperties::variables, Botcraft::Water, Botcraft::BlockstateProperties::water, Botcraft::BlockstateProperties::waterlogged, and Botcraft::Wood.

Referenced by AssetsManager().

◆ LoadItemsFile()

void Botcraft::AssetsManager::LoadItemsFile ( )
private

Definition at line 962 of file AssetsManager.cpp.

References ProtocolCraft::Json::Value::get_object(), items, and LOG_ERROR.

Referenced by AssetsManager().

◆ LoadTextures()

void Botcraft::AssetsManager::LoadTextures ( )
private

Definition at line 1044 of file AssetsManager.cpp.

References atlas, and blockstates.

Referenced by AssetsManager().

◆ operator=()

void Botcraft::AssetsManager::operator= ( AssetsManager const &  )
delete

◆ UpdateModelsWithAtlasData()

void Botcraft::AssetsManager::UpdateModelsWithAtlasData ( )
private

Definition at line 1104 of file AssetsManager.cpp.

References atlas, and Botcraft::Blockstate::UpdateModelsWithAtlasData().

Referenced by AssetsManager().

Member Data Documentation

◆ atlas

std::unique_ptr<Renderer::Atlas> Botcraft::AssetsManager::atlas
private

Definition at line 88 of file AssetsManager.hpp.

Referenced by AssetsManager(), GetAtlas(), LoadTextures(), and UpdateModelsWithAtlasData().

◆ biomes

std::unordered_map<int, std::unique_ptr<Biome> > Botcraft::AssetsManager::biomes
private

Definition at line 84 of file AssetsManager.hpp.

Referenced by LoadBiomesFile().

◆ blockstates

std::unordered_map<int, std::unique_ptr<Blockstate> > Botcraft::AssetsManager::blockstates
private

◆ flattened_blockstates

std::vector<const Blockstate*> Botcraft::AssetsManager::flattened_blockstates
private

Definition at line 78 of file AssetsManager.hpp.

Referenced by FlattenBlocks(), GetBlockstate(), and GetBlockstate().

◆ flattened_blockstates_size

size_t Botcraft::AssetsManager::flattened_blockstates_size
private

Definition at line 79 of file AssetsManager.hpp.

Referenced by FlattenBlocks(), and GetBlockstate().

◆ items

std::unordered_map<ItemId, std::unique_ptr<Item> > Botcraft::AssetsManager::items
private

Definition at line 86 of file AssetsManager.hpp.

Referenced by GetItem(), GetItem(), GetItemID(), Items(), and LoadItemsFile().


The documentation for this class was generated from the following files: