mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
Added metadata and nbt to the Control info for ItemStacks
This commit is contained in:
parent
c9f3b926cc
commit
317978787c
2 changed files with 27 additions and 0 deletions
|
@ -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<String> 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()){
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue