22
22
23
23
package dev .galacticraft .mod .compat .rei .client .category ;
24
24
25
- import dev .galacticraft .mod .Constant ;
26
25
import dev .galacticraft .mod .compat .rei .common .GalacticraftREIServerPlugin ;
27
26
import dev .galacticraft .mod .compat .rei .common .display .DefaultFabricationDisplay ;
28
27
import dev .galacticraft .mod .content .GCBlocks ;
40
39
import net .minecraft .network .chat .Component ;
41
40
import org .jetbrains .annotations .NotNull ;
42
41
42
+ import java .text .DecimalFormat ;
43
43
import java .util .LinkedList ;
44
44
import java .util .List ;
45
45
46
+ import static dev .galacticraft .mod .Constant .RecipeViewer .*;
47
+
46
48
@ Environment (EnvType .CLIENT )
47
49
public class DefaultFabricationCategory implements DisplayCategory <DefaultFabricationDisplay > {
48
50
@ Override
@@ -62,36 +64,41 @@ public Component getTitle() {
62
64
63
65
@ Override
64
66
public @ NotNull List <Widget > setupDisplay (DefaultFabricationDisplay recipeDisplay , Rectangle bounds ) {
65
- final Point startPoint = new Point (bounds .getCenterX () - 81 , bounds .getCenterY () - 41 );
67
+ final Point startPoint = new Point (bounds .getCenterX () - CIRCUIT_FABRICATOR_WIDTH / 2 , bounds .getCenterY () - CIRCUIT_FABRICATOR_HEIGHT / 2 );
66
68
67
69
List <Widget > widgets = new LinkedList <>();
68
70
widgets .add (Widgets .createRecipeBase (bounds ));
69
- widgets .add (Widgets .createTexturedWidget (Constant .ScreenTexture .RECIPE_VIEWER_DISPLAY_TEXTURE , new Rectangle (startPoint .x , startPoint .y , 162 , 82 )));
71
+ widgets .add (Widgets .createTexturedWidget (RECIPE_VIEWER_DISPLAY_TEXTURE , new Rectangle (startPoint .x , startPoint .y , CIRCUIT_FABRICATOR_WIDTH , CIRCUIT_FABRICATOR_HEIGHT )));
72
+
73
+ DecimalFormat df = new DecimalFormat ("###.##" );
74
+ double processingTime = recipeDisplay .getProcessingTime ();
75
+ widgets .add (Widgets .createLabel (new Point (bounds .getCenterX (), bounds .y + 5 ),
76
+ Component .translatable ("category.rei.campfire.time" , df .format (processingTime / 20.0D ))).noShadow ().color (0xFF404040 , 0xFFBBBBBB ));
70
77
71
78
// Diamond ingredients
72
79
// Silicon
73
80
// Silicon
74
81
// Redstone
75
82
// User ingredients
76
83
// Output
77
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 1 , startPoint .y + 1 )).entries (recipeDisplay .getInputEntries ().get (0 )));
78
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 55 , startPoint .y + 47 )).entries (recipeDisplay .getInputEntries ().get (1 )));
79
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 55 , startPoint .y + 65 )).entries (recipeDisplay .getInputEntries ().get (2 )));
80
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 109 , startPoint .y + 47 )).entries (recipeDisplay .getInputEntries ().get (3 )));
81
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 127 , startPoint .y + 1 )). markOutput ( ).entries (recipeDisplay .getInputEntries ().get (4 )));
84
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + DIAMOND_X , startPoint .y + DIAMOND_Y )).entries (recipeDisplay .getInputEntries ().get (0 )));
85
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + SILICON_X_1 , startPoint .y + SILICON_Y_1 )).entries (recipeDisplay .getInputEntries ().get (1 )));
86
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + SILICON_X_2 , startPoint .y + SILICON_Y_2 )).entries (recipeDisplay .getInputEntries ().get (2 )));
87
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + REDSTONE_X , startPoint .y + REDSTONE_Y )).entries (recipeDisplay .getInputEntries ().get (3 )));
88
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + INGREDIENT_X , startPoint .y + INGREDIENT_Y ) ).entries (recipeDisplay .getInputEntries ().get (4 )));
82
89
83
- widgets .add (Widgets .createSlot (new Point (startPoint .x + 145 , startPoint .y + 65 )).markOutput ().entries (recipeDisplay .getOutputEntries ().get (0 )));
90
+ widgets .add (Widgets .createSlot (new Point (startPoint .x + WAFER_X , startPoint .y + WAFER_Y )).markOutput ().entries (recipeDisplay .getOutputEntries ().get (0 )));
84
91
return widgets ;
85
92
}
86
93
87
94
@ Override
88
95
public int getDisplayHeight () {
89
- return 90 ;
96
+ return CIRCUIT_FABRICATOR_HEIGHT + 8 ;
90
97
}
91
98
92
99
@ Override
93
100
public int getDisplayWidth (DefaultFabricationDisplay display ) {
94
- return 170 ;
101
+ return CIRCUIT_FABRICATOR_WIDTH + 8 ;
95
102
}
96
103
97
104
@ Override
0 commit comments