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