3434
3535/**
3636 * Alternative research UI that visualizes the research dependency graph.
37+ *
38+ * Compact layout (340x250) matching ResearchTableScreen:
39+ * Left column (~100px): Drive, Cube, cost grid, buckets, idea chip, fluid gauge
40+ * Right area: Graph viewport with zoom/pan
41+ * Bottom: Player inventory + hotbar (centered)
3742 */
3843public class ResearchTreeScreen extends AbstractContainerScreen <ResearchTableMenu > {
3944
@@ -52,10 +57,11 @@ public class ResearchTreeScreen extends AbstractContainerScreen<ResearchTableMen
5257 private static final int LAYER_X_GAP = 178 ;
5358 private static final int LAYER_Y_GAP = 64 ;
5459
55- private static final int GRAPH_X = 186 ;
56- private static final int GRAPH_Y = 34 ;
57- private static final int GRAPH_W = 314 ;
58- private static final int GRAPH_H = 112 ;
60+ // Graph viewport (right of the left column)
61+ private static final int GRAPH_X = 108 ;
62+ private static final int GRAPH_Y = 32 ;
63+ private static final int GRAPH_W = 228 ;
64+ private static final int GRAPH_H = 114 ;
5965
6066 private enum EdgeStyle {
6167 SINGLE ,
@@ -106,34 +112,34 @@ private record Dependency(ResourceLocation sourceId, EdgeStyle style) {}
106112
107113 public ResearchTreeScreen (ResearchTableMenu menu , Inventory playerInv , Component title ) {
108114 super (menu , playerInv , title );
109- this .imageWidth = 520 ;
110- this .imageHeight = 286 ;
111- this .inventoryLabelX = 179 ;
112- this .inventoryLabelY = 158 ;
115+ this .imageWidth = 340 ;
116+ this .imageHeight = 250 ;
117+ this .inventoryLabelX = 89 ;
118+ this .inventoryLabelY = 153 ;
113119 }
114120
115121 @ Override
116122 protected void init () {
117123 super .init ();
118124
119- this .startButton = addRenderableWidget (Button .builder (Component .literal ("Start Research " ), b -> onStartResearch ())
120- .bounds (leftPos + 22 , topPos + 104 , 140 , 18 )
125+ this .startButton = addRenderableWidget (Button .builder (Component .literal ("Start" ), b -> onStartResearch ())
126+ .bounds (leftPos + 10 , topPos + 112 , 40 , 14 )
121127 .build ());
122128
123- this .listButton = addRenderableWidget (Button .builder (Component .literal ("List View " ), b -> openListView ())
124- .bounds (leftPos + 22 , topPos + 126 , 62 , 18 )
129+ this .listButton = addRenderableWidget (Button .builder (Component .literal ("List" ), b -> openListView ())
130+ .bounds (leftPos + 54 , topPos + 112 , 40 , 14 )
125131 .build ());
126132
127133 this .fitButton = addRenderableWidget (Button .builder (Component .literal ("Fit" ), b -> fitGraphToViewport ())
128- .bounds (leftPos + 88 , topPos + 126 , 36 , 18 )
134+ .bounds (leftPos + 10 , topPos + 130 , 30 , 14 )
129135 .build ());
130136
131137 this .zoomOutButton = addRenderableWidget (Button .builder (Component .literal ("-" ), b -> adjustZoom (-0.12f ))
132- .bounds (leftPos + 128 , topPos + 126 , 18 , 18 )
138+ .bounds (leftPos + 44 , topPos + 130 , 18 , 14 )
133139 .build ());
134140
135141 this .zoomInButton = addRenderableWidget (Button .builder (Component .literal ("+" ), b -> adjustZoom (0.12f ))
136- .bounds (leftPos + 150 , topPos + 126 , 18 , 18 )
142+ .bounds (leftPos + 66 , topPos + 130 , 18 , 14 )
137143 .build ());
138144
139145 buildGraph ();
@@ -398,17 +404,22 @@ protected void renderBg(GuiGraphics g, float partialTick, int mouseX, int mouseY
398404 int x = leftPos ;
399405 int y = topPos ;
400406
407+ // Outer background
401408 g .fill (x , y , x + imageWidth , y + imageHeight , BG_OUTER );
402409 g .fill (x , y , x + imageWidth , y + 1 , 0xFFFFFFFF );
403410 g .fill (x , y , x + 1 , y + imageHeight , 0xFFFFFFFF );
404411 g .fill (x + imageWidth - 1 , y , x + imageWidth , y + imageHeight , PANEL_DARK );
405412 g .fill (x , y + imageHeight - 1 , x + imageWidth , y + imageHeight , PANEL_DARK );
406413
407- drawPanel (g , x + 10 , y + 20 , imageWidth - 20 , 132 );
408- drawPanel (g , x + 10 , y + 156 , imageWidth - 20 , 122 );
414+ // Main top panel
415+ drawPanel (g , x + 4 , y + 14 , 332 , 140 );
416+ // Bottom inventory panel
417+ drawPanel (g , x + 4 , y + 156 , 332 , 90 );
409418
410- // Left utility/slot dock tied to the existing ResearchTableMenu slots.
411- drawPanel (g , x + 20 , y + 34 , 160 , 118 );
419+ // Left machine column sub-panel
420+ drawPanel (g , x + 6 , y + 16 , 100 , 136 );
421+
422+ // Slot backgrounds in left column
412423 drawSlotBg (g , x + ResearchTableMenu .DRIVE_X , y + ResearchTableMenu .DRIVE_Y );
413424 drawSlotBg (g , x + ResearchTableMenu .CUBE_X , y + ResearchTableMenu .CUBE_Y );
414425 for (int row = 0 ; row < 2 ; row ++) {
@@ -418,7 +429,8 @@ protected void renderBg(GuiGraphics g, float partialTick, int mouseX, int mouseY
418429 }
419430 drawSlotBg (g , x + ResearchTableMenu .BUCKET_IN_X , y + ResearchTableMenu .BUCKET_IN_Y );
420431 drawSlotBg (g , x + ResearchTableMenu .BUCKET_OUT_X , y + ResearchTableMenu .BUCKET_OUT_Y );
421- drawFluidGauge (g , x + 154 , y + 36 , 16 , 58 );
432+ drawSlotBg (g , x + ResearchTableMenu .IDEA_CHIP_X , y + ResearchTableMenu .IDEA_CHIP_Y );
433+ drawFluidGauge (g , x + 92 , y + 26 , 12 , 54 );
422434
423435 // Player inventory slot backgrounds
424436 for (int row = 0 ; row < 3 ; row ++) {
@@ -431,8 +443,9 @@ protected void renderBg(GuiGraphics g, float partialTick, int mouseX, int mouseY
431443 }
432444
433445 // Header strip
434- g .fill (x + 20 , y + 22 , x + imageWidth - 20 , y + 32 , 0xFF1C2030 );
446+ g .fill (x + 6 , y + 16 , x + 106 , y + 26 , 0xFF1C2030 );
435447
448+ // Graph viewport
436449 int gx = x + GRAPH_X ;
437450 int gy = y + GRAPH_Y ;
438451 g .fill (gx , gy , gx + GRAPH_W , gy + GRAPH_H , GRAPH_BG );
@@ -719,17 +732,18 @@ private void renderNodeTooltip(GuiGraphics graphics, NodeBox node, int mouseX, i
719732 protected void renderLabels (GuiGraphics graphics , int mouseX , int mouseY ) {
720733 graphics .drawString (this .font , this .title , this .titleLabelX , this .titleLabelY , 0xFF202020 , false );
721734 graphics .drawString (this .font , this .playerInventoryTitle , this .inventoryLabelX , this .inventoryLabelY , 0xFFE6EAF5 , false );
722- graphics .drawString (this .font , "Tree View | scroll = zoom, right-drag = pan" , 22 , 24 , 0xFFE5E7EB , false );
723- graphics .drawString (this .font , "AND" , 440 , 24 , EDGE_AND , false );
724- graphics .drawString (this .font , "OR" , 468 , 24 , EDGE_OR , false );
725- graphics .drawString (this .font , "S" , 486 , 24 , EDGE_SINGLE , false );
726- graphics .drawString (this .font , "Drive" , 24 , 36 , 0xFFD3D7E5 , false );
727- graphics .drawString (this .font , "Cube" , 24 , 72 , 0xFFD3D7E5 , false );
728- graphics .drawString (this .font , "Costs" , 70 , 36 , 0xFFD3D7E5 , false );
729- graphics .drawString (this .font , "Fluid" , 154 , 36 , 0xFFD3D7E5 , false );
735+ graphics .drawString (this .font , "Tree View | scroll=zoom, R-drag=pan" , 6 , 18 , 0xFFE5E7EB , false );
736+ graphics .drawString (this .font , "AND" , 108 , 20 , EDGE_AND , false );
737+ graphics .drawString (this .font , "OR" , 132 , 20 , EDGE_OR , false );
738+ graphics .drawString (this .font , "S" , 148 , 20 , EDGE_SINGLE , false );
739+ graphics .drawString (this .font , "Drive" , 8 , 16 , 0xFFD3D7E5 , false );
740+ graphics .drawString (this .font , "Cube" , 8 , 56 , 0xFFD3D7E5 , false );
741+ graphics .drawString (this .font , "Costs" , 36 , 16 , 0xFFD3D7E5 , false );
742+ graphics .drawString (this .font , "Idea" , 70 , 58 , 0xFFD3D7E5 , false );
743+ graphics .drawString (this .font , "Fl." , 92 , 16 , 0xFFD3D7E5 , false );
730744 if (menu .isResearching ()) {
731- graphics .drawString (this .font , "\u25CF Researching" , 22 , 148 , 0xFF77DD77 , false );
745+ graphics .drawString (this .font , "\u25CF Researching" , 10 , 148 , 0xFF77DD77 , false );
732746 }
733- graphics .drawString (this .font , "Zoom " + Math .round (zoom * 100f ) + "%" , 390 , 24 , 0xFFD9DDE7 , false );
747+ graphics .drawString (this .font , Math .round (zoom * 100f ) + "%" , 88 , 132 , 0xFFD9DDE7 , false );
734748 }
735- }
749+ }
0 commit comments