aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/util
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-12-30 01:48:09 +0000
committerGitHub <noreply@github.com>2019-12-30 01:48:09 +0000
commit5af823e80a611090216375fecd3794d345446830 (patch)
treec54a19977b4a25cb86f54394eb9711aaf268efe3 /src/Java/gtPlusPlus/xmod/gregtech/api/util
parenta731e939c6b9a70ac9fd444dbf06243f63f29c06 (diff)
parentcc825179dce70a5f2c4a13730639e3300243e21a (diff)
downloadGT5-Unofficial-5af823e80a611090216375fecd3794d345446830.tar.gz
GT5-Unofficial-5af823e80a611090216375fecd3794d345446830.tar.bz2
GT5-Unofficial-5af823e80a611090216375fecd3794d345446830.zip
Merge pull request #525 from alkcorp/DevTop
+ 6 Months of work, let's get the ball rolling.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/util')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java
new file mode 100644
index 0000000000..74655fb744
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java
@@ -0,0 +1,35 @@
+package gtPlusPlus.xmod.gregtech.api.util;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+
+public class SpecialBehaviourTooltipHandler {
+
+ private static final HashMap<ItemStack, String> mTooltipCache = new HashMap<ItemStack, String>();
+
+ public static void addTooltipForItem(ItemStack aStack, String aTooltip) {
+ mTooltipCache.put(aStack, aTooltip);
+ }
+
+ @SubscribeEvent
+ public void onItemTooltip(ItemTooltipEvent event){
+ if (event != null) {
+ if (event.itemStack != null) {
+ for (ItemStack aKey : mTooltipCache.keySet()) {
+ if (GT_Utility.areStacksEqual(aKey, event.itemStack, false)) {
+ String s = mTooltipCache.get(aKey);
+ if (s != null && s.length() > 0) {
+ event.toolTip.add(EnumChatFormatting.RED+s);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}