forked from MagicBane/Server
Fleshing out constructor
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
package engine.objects;
|
package engine.objects;
|
||||||
|
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -15,10 +17,19 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ItemTemplate {
|
public class ItemTemplate {
|
||||||
|
|
||||||
|
// Global template lookup
|
||||||
public static HashMap<Integer, ItemTemplate> itemTemplates = new HashMap<>();
|
public static HashMap<Integer, ItemTemplate> itemTemplates = new HashMap<>();
|
||||||
|
|
||||||
|
// Template Properties
|
||||||
|
public String obj_name = "";
|
||||||
|
public Vector3fImmutable obj_scale = new Vector3fImmutable();
|
||||||
|
|
||||||
public ItemTemplate(JSONObject jsonObject) {
|
public ItemTemplate(JSONObject jsonObject) {
|
||||||
|
|
||||||
|
obj_name = (String) jsonObject.get("obj_name");
|
||||||
|
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale");
|
||||||
|
obj_scale = new Vector3fImmutable(Float.parseFloat((String) scaleData.get(0)), Float.parseFloat((String) scaleData.get(1)), Float.parseFloat((String) scaleData.get(2)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user