forked from MagicBane/Server
Fleshing out constructor
This commit is contained in:
@@ -28,14 +28,22 @@ public class ItemTemplate {
|
|||||||
|
|
||||||
public ItemTemplate(JSONObject jsonObject) {
|
public ItemTemplate(JSONObject jsonObject) {
|
||||||
|
|
||||||
|
// Reading a String
|
||||||
|
|
||||||
obj_name = (String) jsonObject.get("obj_name");
|
obj_name = (String) jsonObject.get("obj_name");
|
||||||
|
|
||||||
|
// Reading floats from an array
|
||||||
|
|
||||||
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
|
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
|
||||||
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());
|
||||||
|
|
||||||
|
// Reading an integer value
|
||||||
|
|
||||||
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
|
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
|
||||||
|
|
||||||
|
// Reading a hashmap of floats
|
||||||
|
|
||||||
JSONObject resist_json = (JSONObject) jsonObject.get("combat_attack_resist");
|
JSONObject resist_json = (JSONObject) jsonObject.get("combat_attack_resist");
|
||||||
|
|
||||||
for (Object key : resist_json.keySet()) {
|
for (Object key : resist_json.keySet()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user