private void dropRecord(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof BlockJukebox.TileEntityJukebox) { BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox) tileentity; ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord(); if (itemstack != null) { worldIn.playEvent(1010, pos, 0); worldIn.playRecord(pos, (SoundEvent) null); blockjukebox$tileentityjukebox.setRecord((ItemStack) null); float f = 0.7F; double d0 = (double) (worldIn.rand.nextFloat() * 0.7F) + 0.15000000596046448D; double d1 = (double) (worldIn.rand.nextFloat() * 0.7F) + 0.06000000238418579D + 0.6D; double d2 = (double) (worldIn.rand.nextFloat() * 0.7F) + 0.15000000596046448D; ItemStack itemstack1 = itemstack.copy(); EntityItem entityitem = new EntityItem( worldIn, (double) pos.getX() + d0, (double) pos.getY() + d1, (double) pos.getZ() + d2, itemstack1); entityitem.setDefaultPickupDelay(); worldIn.spawnEntityInWorld(entityitem); } } } }
public void insertRecord(World worldIn, BlockPos pos, IBlockState state, ItemStack recordStack) { if (!worldIn.isRemote) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof BlockJukebox.TileEntityJukebox) { ((BlockJukebox.TileEntityJukebox) tileentity).setRecord(recordStack.copy()); worldIn.setBlockState(pos, state.withProperty(HAS_RECORD, Boolean.valueOf(true)), 2); } } }