mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
block inventories (backend)
This commit is contained in:
parent
fe57c38edf
commit
87f50f79c9
12 changed files with 108 additions and 18 deletions
|
|
@ -23,6 +23,8 @@ class Lightmap;
|
|||
class ContentLUT;
|
||||
class Inventory;
|
||||
|
||||
using chunk_inventories_map = std::unordered_map<uint, std::shared_ptr<Inventory>>;
|
||||
|
||||
class Chunk {
|
||||
public:
|
||||
int x, z;
|
||||
|
|
@ -32,7 +34,7 @@ public:
|
|||
int flags = 0;
|
||||
|
||||
/* Block inventories map where key is index of block in voxels array */
|
||||
std::unordered_map<uint, std::shared_ptr<Inventory>> inventories;
|
||||
chunk_inventories_map inventories;
|
||||
|
||||
Chunk(int x, int z);
|
||||
|
||||
|
|
@ -55,6 +57,8 @@ public:
|
|||
@return inventory id or 0 if block does not exists */
|
||||
void addBlockInventory(std::shared_ptr<Inventory> inventory,
|
||||
uint x, uint y, uint z);
|
||||
void removeBlockInventory(uint x, uint y, uint z);
|
||||
void setBlockInventories(chunk_inventories_map map);
|
||||
|
||||
/* @return inventory bound to the given block or nullptr */
|
||||
std::shared_ptr<Inventory> getBlockInventory(uint x, uint y, uint z) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue