forked from MagicBane/Server
More parsing work.
This commit is contained in:
@@ -25,6 +25,8 @@ public class ItemTemplate {
|
||||
// Template Properties
|
||||
public String obj_name;
|
||||
public Vector3fImmutable obj_scale;
|
||||
public Vector3fImmutable obj_forward_vector;
|
||||
public Vector3fImmutable obj_default_alignment;
|
||||
public int obj_render_object;
|
||||
public int obj_icon;
|
||||
public float combat_health_current;
|
||||
@@ -84,10 +86,23 @@ public class ItemTemplate {
|
||||
// Reading floats from an array (note always check for empty arrays)
|
||||
|
||||
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
|
||||
|
||||
if (scaleData.isEmpty() == false)
|
||||
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).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
|
||||
|
||||
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
|
||||
|
||||
Reference in New Issue
Block a user