1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
package gregtech.nei;
import static gregtech.api.util.GTUtility.isStringInvalid;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.client.Minecraft;
import gregtech.api.objects.overclockdescriber.OverclockDescriber;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.util.FieldsAreNonnullByDefault;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.api.util.OverclockCalculator;
/**
* Holds info used for drawing descriptions on NEI.
*/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
public class RecipeDisplayInfo {
/**
* Recipe to show description.
*/
public final GTRecipe recipe;
/**
* RecipeMap the recipe belongs to.
*/
public final RecipeMap<?> recipeMap;
/**
* When user looks up usage for machine, NEI will show all the recipes that the machine can process, taking tier of
* the machine into consideration. This object can be used to show info around overclocked EU/t and duration.
*/
public final OverclockDescriber overclockDescriber;
/**
* Pre-built overclock calculator, used for drawing OC information. Do not calculate it again.
*/
public final OverclockCalculator calculator;
/**
* Current Y position for drawing description.
*/
private int yPos;
private final int neiTextColorOverride;
RecipeDisplayInfo(GTRecipe recipe, RecipeMap<?> recipeMap, OverclockDescriber overclockDescriber,
OverclockCalculator calculator, int descriptionYOffset, int neiTextColorOverride) {
this.recipe = recipe;
this.recipeMap = recipeMap;
this.overclockDescriber = overclockDescriber;
this.calculator = calculator;
this.yPos = descriptionYOffset;
this.neiTextColorOverride = neiTextColorOverride;
}
/**
* Draws text.
*/
public void drawText(@Nullable String text) {
drawText(text, 10);
}
/**
* Draws text.
*
* @param yShift y position to shift after this text
*/
public void drawText(@Nullable String text, int yShift) {
drawText(text, 5, yShift);
}
/**
* Draws text.
*
* @param xStart x position to start drawing
* @param yShift y position to shift after this text
*/
public void drawText(@Nullable String text, int xStart, int yShift) {
if (isStringInvalid(text)) return;
Minecraft.getMinecraft().fontRenderer
.drawString(text, xStart, yPos, neiTextColorOverride != -1 ? neiTextColorOverride : 0x000000);
yPos += yShift;
}
public void drawTextMultipleLines(List<String> texts) {
for (String text : texts) {
drawText(text, 10);
}
}
}
|