Browse Source

More parsing work.

combat-2
MagicBot 9 months ago
parent
commit
4d118cf634
  1. 15
      src/engine/objects/ItemTemplate.java

15
src/engine/objects/ItemTemplate.java

@ -25,6 +25,8 @@ public class ItemTemplate {
// Template Properties // Template Properties
public String obj_name; public String obj_name;
public Vector3fImmutable obj_scale; public Vector3fImmutable obj_scale;
public Vector3fImmutable obj_forward_vector;
public Vector3fImmutable obj_default_alignment;
public int obj_render_object; public int obj_render_object;
public int obj_icon; public int obj_icon;
public float combat_health_current; public float combat_health_current;
@ -84,10 +86,23 @@ public class ItemTemplate {
// Reading floats from an array (note always check for empty arrays) // Reading floats from an array (note always check for empty arrays)
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale"); JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
if (scaleData.isEmpty() == false) if (scaleData.isEmpty() == false)
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(), obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(),
((Double) scaleData.get(2)).floatValue()); ((Double) scaleData.get(2)).floatValue());
JSONArray forwardVector = (JSONArray) jsonObject.get("obj_forward_vector");
if (forwardVector.isEmpty() == false)
obj_forward_vector = new Vector3fImmutable(((Double) forwardVector.get(0)).floatValue(), ((Double) forwardVector.get(1)).floatValue(),
((Double) forwardVector.get(2)).floatValue());
JSONArray defaultAlighment = (JSONArray) jsonObject.get("obj_default_alignment");
if (defaultAlighment.isEmpty() == false)
obj_default_alignment = new Vector3fImmutable(((Double) defaultAlighment.get(0)).floatValue(), ((Double) defaultAlighment.get(1)).floatValue(),
((Double) defaultAlighment.get(2)).floatValue());
// Reading an integer value // Reading an integer value
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue(); obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();

Loading…
Cancel
Save