From 12608d8d32b4074d2a666d7f200419adc00c0d80 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Feb 2024 12:28:14 -0500 Subject: [PATCH] Fleshing out constructor --- src/engine/objects/ItemTemplate.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 3f3d97a6..c0856334 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -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()) {