diff options
author | Mattes D <github@xoft.cz> | 2014-01-19 22:47:52 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-01-19 22:47:52 +0100 |
commit | fde8b0be60fb58796727d240ceab48a5e2aa0b88 (patch) | |
tree | c7c97ced908edb8d0a719032fb3b9eaff9d7ca7c /src/BlockEntities | |
parent | Rewritten SocketThreads for proper shutdown scenario. (diff) | |
parent | Removed unneeded paramters (diff) | |
download | cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar.gz cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar.bz2 cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar.lz cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar.xz cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.tar.zst cuberite-fde8b0be60fb58796727d240ceab48a5e2aa0b88.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp index ca617b04d..7e9015d33 100644 --- a/src/BlockEntities/CommandBlockEntity.cpp +++ b/src/BlockEntities/CommandBlockEntity.cpp @@ -7,6 +7,7 @@ #include "json/json.h" #include "CommandBlockEntity.h" #include "../Entities/Player.h" +#include "../WorldStorage/FastNBT.h" #include "../CommandOutput.h" #include "../Root.h" @@ -40,6 +41,15 @@ void cCommandBlockEntity::UsedBy(cPlayer * a_Player) void cCommandBlockEntity::SetCommand(const AString & a_Cmd) { m_Command = a_Cmd; + + /* + Vanilla requires that the server send a Block Entity Update after a command has been set + Therefore, command blocks don't support on-the-fly (when window is open) updating of a command and therefore... + ...the following code can't be put in UsedBy just before the window opens + + Just documenting my experience in getting this to work :P + */ + m_World->BroadcastBlockEntity(GetPosX(), GetPosY(), GetPosZ()); } @@ -48,6 +58,7 @@ void cCommandBlockEntity::SetCommand(const AString & a_Cmd) void cCommandBlockEntity::SetLastOutput(const AString & a_LastOut) { + m_World->BroadcastBlockEntity(GetPosX(), GetPosY(), GetPosZ()); m_LastOutput = a_LastOut; } @@ -131,8 +142,7 @@ bool cCommandBlockEntity::Tick(float a_Dt, cChunk & a_Chunk) void cCommandBlockEntity::SendTo(cClientHandle & a_Client) { - // Nothing needs to be sent - UNUSED(a_Client); + a_Client.SendUpdateBlockEntity(*this); } |