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