package mezz.jei;

import javax.annotation.Nonnull;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;

import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import mezz.jei.api.JEIManager;
import mezz.jei.config.Config;

public class TooltipEventHandler {
	private static final String chatFormatting = EnumChatFormatting.BLUE.toString() + EnumChatFormatting.ITALIC.toString();

	@SubscribeEvent
	public void onToolTip(@Nonnull ItemTooltipEvent event) {
		if (!Config.tooltipModNameEnabled) {
			return;
		}

		ItemStack itemStack = event.itemStack;
		if (itemStack == null) {
			return;
		}

		Item item = itemStack.getItem();
		if (item == null) {
			return;
		}

		String modName = JEIManager.itemRegistry.getModNameForItem(item);
		event.toolTip.add(chatFormatting + modName);
	}
}

@@ -300,24 +300,60 @@
 beEvent;%0D%0A%0D%0A
+import mezz.jei.api.IItemRegistry;%0D%0A
 import mezz.
@@ -872,16 +872,123 @@
 %09%7D%0D%0A%0D%0A%09%09
+IItemRegistry itemRegistry = JEIManager.itemRegistry;%0D%0A%09%09if (itemRegistry == null) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09
 String m
@@ -996,27 +996,16 @@
 dName = 
-JEIManager.
 itemRegi

Fix #52 tooltip errors on bukkit/spigot