From 37af60781d0506bac8d7e37e7e807df0740b3bcf Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 1 Mar 2024 08:23:28 -0500 Subject: [PATCH] Template id back-filled when created. --- src/engine/db/handlers/dbItemHandler.java | 1 + src/engine/objects/ItemTemplate.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index 1a620090..89a87987 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -179,6 +179,7 @@ public class dbItemHandler extends dbHandlerBase { int templateID = rs.getInt("id"); JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template")); ItemTemplate itemTemplate = new ItemTemplate(jsonObject); + itemTemplate.template_id = templateID; ItemTemplate.itemTemplates.put(templateID, itemTemplate); } diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index fde75522..e1412de2 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -23,6 +23,8 @@ public class ItemTemplate { // Global template lookup public static HashMap itemTemplates = new HashMap<>(); + public int template_id; + // Template Properties public String obj_name; public boolean obj_pickable;