mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
inventory reindexing
This commit is contained in:
parent
1409df4b86
commit
51ffb93230
12 changed files with 174 additions and 51 deletions
|
|
@ -531,29 +531,7 @@ bool WorldFiles::readWorldInfo(World* world) {
|
|||
}
|
||||
|
||||
void WorldFiles::writePlayer(Player* player) {
|
||||
glm::vec3 position = player->hitbox->position;
|
||||
dynamic::Map root;
|
||||
auto& posarr = root.putList("position");
|
||||
posarr.put(position.x);
|
||||
posarr.put(position.y);
|
||||
posarr.put(position.z);
|
||||
|
||||
auto& rotarr = root.putList("rotation");
|
||||
rotarr.put(player->cam.x);
|
||||
rotarr.put(player->cam.y);
|
||||
|
||||
auto& sparr = root.putList("spawnpoint");
|
||||
glm::vec3 spawnpoint = player->getSpawnPoint();
|
||||
sparr.put(spawnpoint.x);
|
||||
sparr.put(spawnpoint.y);
|
||||
sparr.put(spawnpoint.z);
|
||||
|
||||
root.put("flight", player->flight);
|
||||
root.put("noclip", player->noclip);
|
||||
root.put("chosen-slot", player->getChosenSlot());
|
||||
root.put("inventory", player->getInventory()->write().release());
|
||||
|
||||
files::write_json(getPlayerFile(), &root);
|
||||
files::write_json(getPlayerFile(), player->write().release());
|
||||
}
|
||||
|
||||
bool WorldFiles::readPlayer(Player* player) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue