Fleshing out constructor

This commit is contained in:
2024-02-18 12:28:14 -05:00
parent 8018f1323d
commit 12608d8d32
+8
View File
@@ -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()) {