diff options
author | andrew <xdotftw@gmail.com> | 2014-01-23 13:57:04 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-23 13:57:04 +0100 |
commit | 4ef61d8bf6d815b164a32bdab6a18744cbf0abd2 (patch) | |
tree | fc0c615aba88114ce209b99e7e8c8c5d925117bb /src/BlockEntities | |
parent | Merge pull request #566 from xdot/master (diff) | |
download | cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.gz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.bz2 cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.lz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.xz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.zst cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp index 7e9015d33..db8eb1436 100644 --- a/src/BlockEntities/CommandBlockEntity.cpp +++ b/src/BlockEntities/CommandBlockEntity.cpp @@ -151,9 +151,13 @@ void cCommandBlockEntity::SendTo(cClientHandle & a_Client) bool cCommandBlockEntity::LoadFromJson(const Json::Value & a_Value) { - m_Command = a_Value.get("Command", "").asString(); + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); - m_LastOutput = a_Value.get("LastOutput", "").asString(); + m_Command = a_Value.get("Command", "").asString(); + m_LastOutput = a_Value.get("LastOutput", "").asString(); + m_Result = a_Value.get("SuccessCount", 0).asInt(); return true; } @@ -164,9 +168,13 @@ bool cCommandBlockEntity::LoadFromJson(const Json::Value & a_Value) void cCommandBlockEntity::SaveToJson(Json::Value & a_Value) { - a_Value["Command"] = m_Command; + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; - a_Value["LastOutput"] = m_LastOutput; + a_Value["Command"] = m_Command; + a_Value["LastOutput"] = m_LastOutput; + a_Value["SuccessCount"] = m_Result; } @@ -175,6 +183,14 @@ void cCommandBlockEntity::SaveToJson(Json::Value & a_Value) void cCommandBlockEntity::Execute() { + if (m_World) + { + if (!m_World->AreCommandBlocksEnabled()) + { + return; + } + } + class CommandBlockOutCb : public cCommandOutputCallback { @@ -185,8 +201,6 @@ void cCommandBlockEntity::Execute() virtual void Out(const AString & a_Text) { - ASSERT(m_CmdBlock != NULL); - // Overwrite field m_CmdBlock->SetLastOutput(a_Text); } |