Browse Source

Fleshing out constructor

combat-2
MagicBot 9 months ago
parent
commit
12608d8d32
  1. 8
      src/engine/objects/ItemTemplate.java

8
src/engine/objects/ItemTemplate.java

@ -28,14 +28,22 @@ public class ItemTemplate { @@ -28,14 +28,22 @@ public class ItemTemplate {
public ItemTemplate(JSONObject jsonObject) {
// Reading a String
obj_name = (String) jsonObject.get("obj_name");
// Reading floats from an array
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(),
((Double) scaleData.get(2)).floatValue());
// Reading an integer value
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
// Reading a hashmap of floats
JSONObject resist_json = (JSONObject) jsonObject.get("combat_attack_resist");
for (Object key : resist_json.keySet()) {

Loading…
Cancel
Save