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

Method LoadFromJson

src/BlockEntities/DropSpenserEntity.cpp:147–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146
147bool cDropSpenserEntity::LoadFromJson(const Json::Value & a_Value)
148{
149 m_PosX = a_Value.get("x", 0).asInt();
150 m_PosY = a_Value.get("y", 0).asInt();
151 m_PosZ = a_Value.get("z", 0).asInt();
152
153 Json::Value AllSlots = a_Value.get("Slots", 0);
154 int SlotIdx = 0;
155 for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
156 {
157 cItem Contents;
158 Contents.FromJson(*itr);
159 m_Contents.SetSlot(SlotIdx, Contents);
160 SlotIdx++;
161 if (SlotIdx >= m_Contents.GetNumSlots())
162 {
163 return true;
164 }
165 }
166
167 return true;
168}
169
170
171

Callers

nothing calls this directly

Calls 7

asIntMethod · 0.80
getMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
FromJsonMethod · 0.80
SetSlotMethod · 0.45
GetNumSlotsMethod · 0.45

Tested by

no test coverage detected