2013-10-17 04:27:07 +02:00
|
|
|
package com.pahimar.ee3.core.handlers;
|
|
|
|
|
2013-10-18 07:23:11 +02:00
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
2013-10-17 04:27:07 +02:00
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
|
|
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
|
|
|
|
2013-10-18 07:23:11 +02:00
|
|
|
import com.pahimar.ee3.emc.EmcComponent;
|
2013-10-17 04:27:07 +02:00
|
|
|
import com.pahimar.ee3.emc.EmcRegistry;
|
2013-10-18 07:23:11 +02:00
|
|
|
import com.pahimar.ee3.emc.EmcValue;
|
2013-10-17 04:27:07 +02:00
|
|
|
import com.pahimar.ee3.item.CustomWrappedStack;
|
2013-10-18 07:23:11 +02:00
|
|
|
import com.pahimar.ee3.item.OreStack;
|
|
|
|
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
2013-10-17 04:27:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Equivalent-Exchange-3
|
|
|
|
*
|
|
|
|
* ItemTooltipEventHandler
|
|
|
|
*
|
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class ItemTooltipEventHandler {
|
2013-10-18 07:23:11 +02:00
|
|
|
|
|
|
|
private static boolean debug = true;
|
2013-10-17 04:27:07 +02:00
|
|
|
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
|
|
|
|
2013-10-18 07:23:11 +02:00
|
|
|
CustomWrappedStack stack = new CustomWrappedStack(event.itemStack);
|
|
|
|
if (debug) {
|
|
|
|
event.toolTip.add(EnumChatFormatting.AQUA + "ID: " + event.itemStack.itemID + ", Meta: " + event.itemStack.getItemDamage());
|
|
|
|
if (stack.getWrappedStack() instanceof OreStack) {
|
|
|
|
event.toolTip.add(EnumChatFormatting.AQUA + "OreDictionary Item");
|
|
|
|
}
|
|
|
|
if (RecipeRegistry.getRecipeMappings().containsKey(stack)) {
|
|
|
|
event.toolTip.add(EnumChatFormatting.AQUA + "Made from a recipe");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EmcRegistry.hasEmcValue(stack)) {
|
|
|
|
EmcValue emcValue = EmcRegistry.getEmcValue(stack);
|
|
|
|
|
|
|
|
event.toolTip.add("");
|
|
|
|
event.toolTip.add("EMC: " + emcValue.value);
|
|
|
|
|
|
|
|
if (debug) {
|
|
|
|
for (EmcComponent emcComponent : emcValue.getComponents()) {
|
|
|
|
event.toolTip.add(" * " + emcComponent.getType() + ": " + emcValue.getComponentValueByType(emcComponent.getType()));
|
|
|
|
}
|
|
|
|
}
|
2013-10-17 04:27:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|