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

Method LoadFromJson

src/BlockEntities/ChestEntity.cpp:37–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37bool cChestEntity::LoadFromJson(const Json::Value & a_Value)
38{
39 m_PosX = a_Value.get("x", 0).asInt();
40 m_PosY = a_Value.get("y", 0).asInt();
41 m_PosZ = a_Value.get("z", 0).asInt();
42
43 Json::Value AllSlots = a_Value.get("Slots", 0);
44 int SlotIdx = 0;
45 for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
46 {
47 cItem Item;
48 Item.FromJson(*itr);
49 SetSlot(SlotIdx, Item);
50 SlotIdx++;
51 }
52 return true;
53}
54
55
56

Callers

nothing calls this directly

Calls 5

asIntMethod · 0.80
getMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
FromJsonMethod · 0.80

Tested by

no test coverage detected