summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java
blob: 929d44255170437bffdb275af9965599b7ef8f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
 * 
 */
package darkknight.jewelrycraft.item;

import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.util.JewelryNBT;

public class ItemGoldObj extends Item
{
    public ItemGoldObj()
    {}
    
    public boolean requiresMultipleRenderPasses()
    {
        return true;
    }
    
    @SideOnly (Side.CLIENT)
    public boolean hasEffect(ItemStack item)
    {
        return true;
    }
    
    @SideOnly (Side.CLIENT)
    public int getColorFromItemStack(ItemStack stack, int pass)
    {
        return 0xffff00;
    }
    
    @Override
    public IIcon getIcon(ItemStack stack, int pass)
    {
        ItemStack item = JewelryNBT.item(stack);
        if (item != null) return item.getIconIndex();
        return new ItemStack(Blocks.end_portal).getIconIndex();
    }
    
    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");
    }
    
    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 :(");
    }
}