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

Method LoadFromJson

src/BlockEntities/FurnaceEntity.cpp:135–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134
135bool cFurnaceEntity::LoadFromJson(const Json::Value & a_Value)
136{
137 m_PosX = a_Value.get("x", 0).asInt();
138 m_PosY = a_Value.get("y", 0).asInt();
139 m_PosZ = a_Value.get("z", 0).asInt();
140
141 Json::Value AllSlots = a_Value.get("Slots", 0);
142 int SlotIdx = 0;
143 for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr)
144 {
145 cItem Item;
146 Item.FromJson(*itr);
147 SetSlot(SlotIdx, Item);
148 SlotIdx++;
149 }
150
151 m_NeedCookTime = (int)(a_Value.get("CookTime", 0).asDouble() / 50);
152 m_TimeCooked = (int)(a_Value.get("TimeCooked", 0).asDouble() / 50);
153 m_FuelBurnTime = (int)(a_Value.get("BurnTime", 0).asDouble() / 50);
154 m_TimeBurned = (int)(a_Value.get("TimeBurned", 0).asDouble() / 50);
155
156 return true;
157}
158
159
160

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected