From 453d20a124a81bbd26ede4f405298e0ede3f23e4 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 25 Apr 2015 01:34:58 +0100 Subject: - Changed the build.gradle file to output more fancy files and proper build names - Fixed a problem with the Golden Object crashing if it doesn't have an object in the Jewelry Modifier GUI - Improved the GUI of the Jewelry Modifier so it keeps the selection even if you re-size the screen and added a button for adding items for Golden Objects --- .../java/darkknight/jewelrycraft/item/ItemGoldObj.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java') diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java index 41ac9ec..dae54e7 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java @@ -5,6 +5,7 @@ package darkknight.jewelrycraft.item; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -16,6 +17,7 @@ import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.util.JewelryNBT; +import darkknight.jewelrycraft.util.Variables; public class ItemGoldObj extends Item { @@ -39,6 +41,12 @@ public class ItemGoldObj extends Item return 0xffff00; } + @Override + public void registerIcons(IIconRegister iconRegister) + { + itemIcon = iconRegister.registerIcon("apple_golden"); + } + @Override public IIcon getIcon(ItemStack stack, int pass) { @@ -49,13 +57,13 @@ public class ItemGoldObj extends Item public String getItemStackDisplayName(ItemStack stack) { - return "Golden " + (stack != null && (Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null && JewelryNBT.item(stack) != null) ? JewelryNBT.item(stack).getDisplayName() : "Object"); + if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("target") && Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null && JewelryNBT.item(stack) != null) return "Golden " + JewelryNBT.item(stack).getDisplayName(); + return "Golden Object"; } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean displayInfo) { - if (displayInfo) - if(JewelryNBT.item(stack).getItem() instanceof ItemFood) list.add(EnumChatFormatting.DARK_PURPLE + "It's made of solid gold! How are you suppose to eat this?"); - else list.add(EnumChatFormatting.DARK_PURPLE + "Shiny, but useless :("); + if (displayInfo) if (stack != null && JewelryNBT.item(stack) != null && JewelryNBT.item(stack).getItem() instanceof ItemFood) list.add(EnumChatFormatting.DARK_PURPLE + "It's made of solid gold! How are you suppose to eat this?"); + else list.add(EnumChatFormatting.DARK_PURPLE + "Shiny, but useless :("); } } -- cgit v1.2.3