MCPcopy Create free account
hub / github.com/cuberite/cuberite / LoadCommandBlockFromNBT

Method LoadCommandBlockFromNBT

src/WorldStorage/WSSAnvil.cpp:1018–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016
1017
1018void cWSSAnvil::LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx)
1019{
1020 ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound);
1021 int x, y, z;
1022 if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z))
1023 {
1024 return;
1025 }
1026 std::auto_ptr<cCommandBlockEntity> CmdBlock(new cCommandBlockEntity(x, y, z, m_World));
1027
1028 int currentLine = a_NBT.FindChildByName(a_TagIdx, "Command");
1029 if (currentLine >= 0)
1030 {
1031 CmdBlock->SetCommand(a_NBT.GetString(currentLine));
1032 }
1033
1034 currentLine = a_NBT.FindChildByName(a_TagIdx, "SuccessCount");
1035 if (currentLine >= 0)
1036 {
1037 CmdBlock->SetResult(a_NBT.GetInt(currentLine));
1038 }
1039
1040 currentLine = a_NBT.FindChildByName(a_TagIdx, "LastOutput");
1041 if (currentLine >= 0)
1042 {
1043 CmdBlock->SetLastOutput(a_NBT.GetString(currentLine));
1044 }
1045
1046 // TODO 2014-01-18 xdot: Figure out what TrackOutput is and parse it.
1047
1048 a_BlockEntities.push_back(CmdBlock.release());
1049}
1050
1051
1052

Callers

nothing calls this directly

Calls 8

SetCommandMethod · 0.80
GetStringMethod · 0.80
GetIntMethod · 0.80
SetLastOutputMethod · 0.80
releaseMethod · 0.80
GetTypeMethod · 0.45
FindChildByNameMethod · 0.45
SetResultMethod · 0.45

Tested by

no test coverage detected