From 188150bf829add4418cdbb15f679d705b489ff9e Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Fri, 20 Dec 2013 11:47:07 +0200 Subject: Working stuff --- common/darkknight/jewelrycraft/item/ItemRing.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/darkknight/jewelrycraft/item/ItemRing.java') diff --git a/common/darkknight/jewelrycraft/item/ItemRing.java b/common/darkknight/jewelrycraft/item/ItemRing.java index 3941770..1207bac 100644 --- a/common/darkknight/jewelrycraft/item/ItemRing.java +++ b/common/darkknight/jewelrycraft/item/ItemRing.java @@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; public class ItemRing extends ItemBase @@ -69,6 +70,21 @@ public class ItemRing extends ItemBase return 0; } + public String getItemDisplayName(ItemStack stack) + { + if (stack.hasTagCompound()) + { + if (stack.getTagCompound().hasKey("ingot")) + { + NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot"); + ItemStack ingotStack = new ItemStack(0, 0, 0); + ingotStack.readFromNBT(ingotNBT); + return ingotStack.getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim(); + } + } + return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim(); + } + public static void addMetal(ItemStack item, ItemStack metal) { NBTTagCompound itemStackData; -- cgit v1.2.3