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.setTabToDisplayOn(CreativeTabs.tabMisc); 018 } 019 020 public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) 021 { 022 if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) 023 { 024 if (par3World.isRemote) 025 { 026 return true; 027 } 028 else 029 { 030 ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, this.shiftedIndex); 031 par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.shiftedIndex); 032 --par1ItemStack.stackSize; 033 return true; 034 } 035 } 036 else 037 { 038 return false; 039 } 040 } 041 042 @SideOnly(Side.CLIENT) 043 044 /** 045 * allows items to add custom lines of information to the mouseover description 046 */ 047 public void addInformation(ItemStack par1ItemStack, List par2List) 048 { 049 par2List.add("C418 - " + this.recordName); 050 } 051 052 @SideOnly(Side.CLIENT) 053 054 /** 055 * Return an item rarity from EnumRarity 056 */ 057 public EnumRarity getRarity(ItemStack par1ItemStack) 058 { 059 return EnumRarity.rare; 060 } 061 }