summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/CommandBlockEntity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-19 14:25:35 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-19 14:25:35 +0100
commit1af89a8b50a382ef0f5c137a84ab2816c45cc73c (patch)
tree710e4ef25d4785515a3ca07a94dc4b516dd15286 /src/BlockEntities/CommandBlockEntity.cpp
parentImplemented MC|Brand response (diff)
downloadcuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar.gz
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar.bz2
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar.lz
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar.xz
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.tar.zst
cuberite-1af89a8b50a382ef0f5c137a84ab2816c45cc73c.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/CommandBlockEntity.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp
index 6e5c8087e..38737d619 100644
--- a/src/BlockEntities/CommandBlockEntity.cpp
+++ b/src/BlockEntities/CommandBlockEntity.cpp
@@ -58,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;
}
@@ -141,30 +142,7 @@ bool cCommandBlockEntity::Tick(float a_Dt, cChunk & a_Chunk)
void cCommandBlockEntity::SendTo(cClientHandle & a_Client)
{
- cFastNBTWriter Writer;
- Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
- Writer.AddInt("SuccessCount", GetResult());
- Writer.AddInt("x", GetPosX());
- Writer.AddInt("y", GetPosY());
- Writer.AddInt("z", GetPosZ());
- Writer.AddString("Command", GetCommand().c_str());
- // You can set custom names for windows in Vanilla
- // For a command block, this would be the 'name' prepended to anything it outputs into global chat
- // MCS doesn't have this, so just leave it @ '@'. (geddit?)
- Writer.AddString("CustomName", "@");
- Writer.AddString("id", "Control"); // "Tile Entity ID" - MC wiki; vanilla server always seems to send this though
-
- if (!GetLastOutput().empty())
- {
- AString Output;
- Printf(Output, "{\"text\":\"%s\"}", GetLastOutput().c_str());
-
- Writer.AddString("LastOutput", Output.c_str());
- }
-
- Writer.Finish();
-
- a_Client.SendUpdateBlockEntity(GetPosX(), GetPosY(), GetPosZ(), 2, Writer);
+ a_Client.SendUpdateBlockEntity(GetPosX(), GetPosY(), GetPosZ(), 2, *this);
}