diff --git a/src/main/java/crazypants/structures/creator/block/tree/EditorTreeNode.java b/src/main/java/crazypants/structures/creator/block/tree/EditorTreeNode.java index 3ff83f2..46e9d0e 100644 --- a/src/main/java/crazypants/structures/creator/block/tree/EditorTreeNode.java +++ b/src/main/java/crazypants/structures/creator/block/tree/EditorTreeNode.java @@ -29,9 +29,7 @@ public EditorTreeNode(Object owner, IAttributeAccessor aa, Object currentValue, this.treeModel = treeModel; data = new NodeData(owner, aa, currentValue, this); setUserObject(data); - if( addChildrenOfResources || !(currentValue instanceof IResource) || (currentValue instanceof LootCategories)) { - addChildren(currentValue); - } + addChildren(currentValue, addChildrenOfResources); } public NodeData getData() { @@ -46,9 +44,20 @@ public void dataChanged(boolean structureChanged) { } public void addChildren(Object obj) { + addChildren(obj, false); + } + + public void addChildren(Object obj, boolean addChildrenOfResources) { if(obj == null) { return; + } + + + if( !addChildrenOfResources && obj instanceof IResource && !(obj instanceof LootCategories)) { + return; } + + if(obj instanceof List) { addChildren((List) obj, treeModel); return; diff --git a/src/main/java/crazypants/structures/creator/block/tree/editors/AddElementEditor.java b/src/main/java/crazypants/structures/creator/block/tree/editors/AddElementEditor.java index 205ae18..2968195 100644 --- a/src/main/java/crazypants/structures/creator/block/tree/editors/AddElementEditor.java +++ b/src/main/java/crazypants/structures/creator/block/tree/editors/AddElementEditor.java @@ -125,16 +125,14 @@ private void updateOptions() { if(vals != null) { options.addAll(vals); } - } - -// else { //Primitives / Basic types -// try { -// options.add(type.newInstance()); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - if(!options.isEmpty()) { + } else { //Primitives / Basic types + try { + options.add(type.newInstance()); + } catch (Exception e) { + e.printStackTrace(); + } + } + if(options.size() > 1) { cb.setModel(new DefaultComboBoxModel(options.toArray(new Object[options.size()]))); }