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

Method LoadSignFromNBT

src/WorldStorage/WSSAnvil.cpp:942–977  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940
941
942void cWSSAnvil::LoadSignFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx)
943{
944 ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound);
945 int x, y, z;
946 if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z))
947 {
948 return;
949 }
950 std::auto_ptr<cSignEntity> Sign(new cSignEntity(E_BLOCK_SIGN_POST, x, y, z, m_World));
951
952 int currentLine = a_NBT.FindChildByName(a_TagIdx, "Text1");
953 if (currentLine >= 0)
954 {
955 Sign->SetLine(0, a_NBT.GetString(currentLine));
956 }
957
958 currentLine = a_NBT.FindChildByName(a_TagIdx, "Text2");
959 if (currentLine >= 0)
960 {
961 Sign->SetLine(1, a_NBT.GetString(currentLine));
962 }
963
964 currentLine = a_NBT.FindChildByName(a_TagIdx, "Text3");
965 if (currentLine >= 0)
966 {
967 Sign->SetLine(2, a_NBT.GetString(currentLine));
968 }
969
970 currentLine = a_NBT.FindChildByName(a_TagIdx, "Text4");
971 if (currentLine >= 0)
972 {
973 Sign->SetLine(3, a_NBT.GetString(currentLine));
974 }
975
976 a_BlockEntities.push_back(Sign.release());
977}
978
979
980

Callers

nothing calls this directly

Calls 5

SetLineMethod · 0.80
GetStringMethod · 0.80
releaseMethod · 0.80
GetTypeMethod · 0.45
FindChildByNameMethod · 0.45

Tested by

no test coverage detected