diff options
author | Mattes D <github@xoft.cz> | 2014-07-02 22:59:21 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-02 22:59:21 +0200 |
commit | 39fff19955e07460b1160ed962829c9e0a51a454 (patch) | |
tree | cd2b8aa7e24fb9c9052c55a67ea3364b837a5cf5 /src/Entities/Player.cpp | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
parent | Suggestion (diff) | |
download | cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar.gz cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar.bz2 cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar.lz cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar.xz cuberite-39fff19955e07460b1160ed962829c9e0a51a454.tar.zst cuberite-39fff19955e07460b1160ed962829c9e0a51a454.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index aa8757783..dbb8cd26c 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -8,6 +8,7 @@ #include "../World.h" #include "../Bindings/PluginManager.h" #include "../BlockEntities/BlockEntity.h" +#include "../BlockEntities/EnderChestEntity.h" #include "../GroupManager.h" #include "../Group.h" #include "../Root.h" @@ -46,6 +47,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) , m_bTouchGround(false) , m_Stance(0.0) , m_Inventory(*this) + , m_EnderChestContents(9, 3) , m_CurrentWindow(NULL) , m_InventoryWindow(NULL) , m_Color('-') @@ -1752,6 +1754,7 @@ bool cPlayer::LoadFromDisk() } m_Inventory.LoadFromJson(root["inventory"]); + cEnderChestEntity::LoadFromJson(root["enderchestinventory"], m_EnderChestContents); m_LoadedWorldName = root.get("world", "world").asString(); @@ -1789,20 +1792,24 @@ bool cPlayer::SaveToDisk() Json::Value JSON_Inventory; m_Inventory.SaveToJson(JSON_Inventory); + Json::Value JSON_EnderChestInventory; + cEnderChestEntity::SaveToJson(JSON_EnderChestInventory, m_EnderChestContents); + Json::Value root; - root["position"] = JSON_PlayerPosition; - root["rotation"] = JSON_PlayerRotation; - root["inventory"] = JSON_Inventory; - root["health"] = m_Health; - root["xpTotal"] = m_LifetimeTotalXp; - root["xpCurrent"] = m_CurrentXp; - root["air"] = m_AirLevel; - root["food"] = m_FoodLevel; - root["foodSaturation"] = m_FoodSaturationLevel; - root["foodTickTimer"] = m_FoodTickTimer; - root["foodExhaustion"] = m_FoodExhaustionLevel; - root["world"] = GetWorld()->GetName(); - root["isflying"] = IsFlying(); + root["position"] = JSON_PlayerPosition; + root["rotation"] = JSON_PlayerRotation; + root["inventory"] = JSON_Inventory; + root["enderchestinventory"] = JSON_EnderChestInventory; + root["health"] = m_Health; + root["xpTotal"] = m_LifetimeTotalXp; + root["xpCurrent"] = m_CurrentXp; + root["air"] = m_AirLevel; + root["food"] = m_FoodLevel; + root["foodSaturation"] = m_FoodSaturationLevel; + root["foodTickTimer"] = m_FoodTickTimer; + root["foodExhaustion"] = m_FoodExhaustionLevel; + root["world"] = GetWorld()->GetName(); + root["isflying"] = IsFlying(); if (m_GameMode == GetWorld()->GetGameMode()) { |