001    package net.minecraft.item;
002    
003    import cpw.mods.fml.common.Side;
004    import cpw.mods.fml.common.asm.SideOnly;
005    import java.util.HashMap;
006    import java.util.List;
007    import java.util.Map;
008    import net.minecraft.block.Block;
009    import net.minecraft.block.BlockJukeBox;
010    import net.minecraft.creativetab.CreativeTabs;
011    import net.minecraft.entity.player.EntityPlayer;
012    import net.minecraft.world.World;
013    
014    public class ItemRecord extends Item
015    {
016        private static final Map field_90044_b = new HashMap();
017    
018        /** The name of the record. */
019        public final String recordName;
020    
021        protected ItemRecord(int par1, String par2Str)
022        {
023            super(par1);
024            this.recordName = par2Str;
025            this.maxStackSize = 1;
026            this.setCreativeTab(CreativeTabs.tabMisc);
027            field_90044_b.put(par2Str, this);
028        }
029    
030        /**
031         * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
032         * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
033         */
034        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
035        {
036            if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0)
037            {
038                if (par3World.isRemote)
039                {
040                    return true;
041                }
042                else
043                {
044                    ((BlockJukeBox)Block.jukebox).func_85106_a(par3World, par4, par5, par6, par1ItemStack);
045                    par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.shiftedIndex);
046                    --par1ItemStack.stackSize;
047                    return true;
048                }
049            }
050            else
051            {
052                return false;
053            }
054        }
055    
056        @SideOnly(Side.CLIENT)
057    
058        /**
059         * allows items to add custom lines of information to the mouseover description
060         */
061        public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
062        {
063            par3List.add(this.func_90043_g());
064        }
065    
066        @SideOnly(Side.CLIENT)
067        public String func_90043_g()
068        {
069            return "C418 - " + this.recordName;
070        }
071    
072        @SideOnly(Side.CLIENT)
073    
074        /**
075         * Return an item rarity from EnumRarity
076         */
077        public EnumRarity getRarity(ItemStack par1ItemStack)
078        {
079            return EnumRarity.rare;
080        }
081    
082        @SideOnly(Side.CLIENT)
083        public static ItemRecord func_90042_d(String par0Str)
084        {
085            return (ItemRecord)field_90044_b.get(par0Str);
086        }
087    }