aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java
blob: 27dce789ae29ad9625133304f9dbaee62fe81233 (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
package gtPlusPlus.nei;

import java.util.*;

import gregtech.nei.GT_NEI_DefaultHandler;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.*;
import cpw.mods.fml.common.event.FMLInterModComms;
import gregtech.api.enums.GT_Values;
import gregtech.api.util.*;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import net.minecraft.item.ItemStack;

public class GTPP_NEI_DefaultHandler extends GT_NEI_DefaultHandler {

	public GTPP_NEI_DefaultHandler(final GT_Recipe_Map tMap) {
		super(tMap);
		if (!NEI_GT_Config.sIsAdded) {
			FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier());
			GuiCraftingRecipe.craftinghandlers.add(this);
			GuiUsageRecipe.usagehandlers.add(this);
		}
	}

	@Override
	public TemplateRecipeHandler newInstance() {
		return new GTPP_NEI_DefaultHandler(this.mRecipeMap);
	}

	@Override
	public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) {
		super.handleItemTooltip(gui, aStack, currenttip, aRecipeIndex);
		CachedRecipe tObject = this.arecipes.get(aRecipeIndex);
		if (tObject instanceof CachedDefaultRecipe) {
			CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
			for (PositionedStack tStack : tRecipe.mOutputs) {
				// no-op
			}
			for (PositionedStack tStack : tRecipe.mInputs) {
				if (aStack == tStack.item) {
					if (ItemUtils.isMillingBall(aStack)) {
						currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process"));
						currenttip.add("Does not always get consumed in the process");
					}
					if (ItemUtils.isCatalyst(aStack)) {
						currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process"));
						currenttip.add("Does not always get consumed in the process");
						currenttip.add("Higher tier pipe casings allow this item to last longer");
					}
				}
			}
		}

		return currenttip;
	}
}