Skip to content

Commit 70a2f2b

Browse files
Fix creating heads for non existent parents/children
1 parent f498d07 commit 70a2f2b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/com/portingdeadmods/researchd/client/screens/lines/ResearchHead.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ public static UniqueArray<ResearchHead> inputsOf(ResearchNode node) {
6363
int parentCount = node.getParents().size();
6464
int width = ResearchScreenWidget.PANEL_WIDTH; // Node width
6565

66-
// If no parents or just one, create a centered head
67-
if (parentCount == 0 || parentCount == 1) {
66+
if (parentCount == 0) return positions;
67+
68+
// If one, create a centered head
69+
if (parentCount == 1) {
6870
int x = node.getX() + width / 2;
6971
int y = node.getY();
7072
positions.add(new ResearchHead(x, y, true));
@@ -91,8 +93,10 @@ public static UniqueArray<ResearchHead> outputsOf(ResearchNode node) {
9193
int childCount = node.getChildren().size();
9294
int width = ResearchScreenWidget.PANEL_WIDTH; // Node width
9395

94-
// If no children or just one, create a centered head
95-
if (childCount == 0 || childCount == 1) {
96+
if (childCount == 0) return positions;
97+
98+
// If one, create a centered head
99+
if (childCount == 1) {
96100
int x = node.getX() + width / 2;
97101
int y = node.getY() + ResearchScreenWidget.PANEL_HEIGHT - 1;
98102
positions.add(new ResearchHead(x, y, false));

0 commit comments

Comments
 (0)