diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-04-25 01:34:58 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-04-25 01:34:58 +0100 |
| commit | 453d20a124a81bbd26ede4f405298e0ede3f23e4 (patch) | |
| tree | 93f6f74150a8fc03fe2d35b0d853e3416c033ca5 /src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java | |
| parent | 1db974998c4e5242cd2603020e6c8ebfea5b454e (diff) | |
- 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
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java | 16 |
1 files changed, 12 insertions, 4 deletions
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 { @@ -40,6 +42,12 @@ public class ItemGoldObj extends Item } @Override + public void registerIcons(IIconRegister iconRegister) + { + itemIcon = iconRegister.registerIcon("apple_golden"); + } + + @Override public IIcon getIcon(ItemStack stack, int pass) { ItemStack item = JewelryNBT.item(stack); @@ -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 :("); } } |
