diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java index 0a81def15..7da2a0ad3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java @@ -16,11 +16,14 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.oredict.OreDictionary; +import java.util.List; + //TODO Add meta & nbt info public class TooltipEvent{ @@ -66,8 +69,29 @@ public class TooltipEvent{ event.toolTip.add(ADVANCED_INFO_TEXT_PRE+metaName); } + //Metadata + int meta = event.itemStack.getItemDamage(); + event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".meta.desc")+":"); + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+meta); + + //NBT + NBTTagCompound compound = event.itemStack.getTagCompound(); + if(compound != null && !compound.hasNoTags()){ + event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".nbt.desc")+":"); + if(KeyUtil.isShiftPressed()){ + List strgList = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(compound.toString(), 200); + for(String strg : strgList){ + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+strg); + } + } + else{ + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+EnumChatFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]"); + } + } + //Disabling Info event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200)); + } else{ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){ diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index b6aee6706..50df5adb9 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -425,7 +425,10 @@ tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries tooltip.actuallyadditions.noOredictNameAvail.desc=None tooltip.actuallyadditions.codeName.desc=Code Name tooltip.actuallyadditions.baseUnlocName.desc=Item's Unlocalized Name +tooltip.actuallyadditions.meta.desc=Item's Metadata +tooltip.actuallyadditions.nbt.desc=Item's current NBT tooltip.actuallyadditions.unlocName.desc=Meta's Unlocalized Name +tooltip.actuallyadditions.pressShift.desc=Press Shift tooltip.actuallyadditions.disablingInfo.desc=If you don't want this Information to appear, disable it in the Actually Additions Config! tooltip.actuallyadditions.ctrlForMoreInfo.desc=Press CTRL for Advanced Info tooltip.actuallyadditions.extraInfo.desc=Advanced Info