blob: 10a9fe4da6c52d22e7783c67bbd6139121587b39 (
plain)
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
|
package gtPlusPlus.api.recipe;
import static net.minecraft.util.EnumChatFormatting.GRAY;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.util.StatCollector;
import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.nei.GT_NEI_DefaultHandler;
import gregtech.nei.RecipeDisplayInfo;
import gregtech.nei.formatter.INEISpecialInfoFormatter;
import gtPlusPlus.core.item.ModItems;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class TGSFrontend extends RecipeMapFrontend {
public TGSFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder, NEIRecipePropertiesBuilder neiPropertiesBuilder) {
super(uiPropertiesBuilder, neiPropertiesBuilder.neiSpecialInfoFormatter(new TGSSpecialValueFormatter()));
}
@Override
protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) {}
@Override
protected void drawDurationInfo(RecipeDisplayInfo recipeInfo) {}
@Override
protected List<String> handleNEIItemOutputTooltip(List<String> currentTip,
GT_NEI_DefaultHandler.FixedPositionedStack pStack) {
if (ModItems.fluidFertBasic != null && pStack.isChanceBased()) {
currentTip.add(
GRAY + StatCollector.translateToLocalFormatted(
"gtpp.nei.tgs.sapling",
StatCollector.translateToLocal(ModItems.fluidFertBasic.getUnlocalizedName())));
} else {
super.handleNEIItemOutputTooltip(currentTip, pStack);
}
return currentTip;
}
@Override
protected void drawNEIOverlayForOutput(GT_NEI_DefaultHandler.FixedPositionedStack stack) {}
private static class TGSSpecialValueFormatter implements INEISpecialInfoFormatter {
@Override
public List<String> format(RecipeDisplayInfo recipeInfo) {
if (ModItems.fluidFertBasic == null) {
return Collections.emptyList();
}
return Arrays.asList(
StatCollector.translateToLocal("gtpp.nei.tgs.1"),
StatCollector.translateToLocalFormatted(
"gtpp.nei.tgs.2",
StatCollector.translateToLocal(ModItems.fluidFertBasic.getUnlocalizedName())),
StatCollector.translateToLocal("gtpp.nei.tgs.3"));
}
}
}
|