use of org.lanternpowered.server.advancement.LanternAdvancement in project LanternServer by LanternPowered.
the class LanternTreeLayout method generateNode.
private static TreeNode generateNode(Advancement advancement, TreeLayoutElement element, int column) {
final TreeNode treeNode = new TreeNode(element, (double) column * HORIZONTAL_OFFSET);
TreeNode previous = null;
for (Advancement child : advancement.getChildren()) {
final TreeLayoutElement childElement = ((LanternAdvancement) child).getLayoutElement();
if (childElement != null) {
final TreeNode childNode = generateNode(child, childElement, column + 1);
childNode.previous = previous;
childNode.parent = treeNode;
if (previous != null) {
previous.next = childNode;
}
treeNode.children.add(childNode);
previous = childNode;
}
}
return treeNode;
}
Aggregations