       jumpSpeed: 0.001
     }
 
-  toolbar = createToolbar {el: '#tools'}
-  toolbar.on 'select', (material) ->
-    game.currentMaterial = +material
-
 
   console.log 'initializing plugins'
   plugins = createPlugins game, {require: require}

  debris.on 'collect', (item) ->
    console.log 'collect', item

  playerInventory = new Inventory(10)

  mine.on 'break', (target) =>
    if plugins.isEnabled('debris') # TODO: refactor into module itself (event listener)

  ever(document.body).on 'contextmenu', (event) ->
    event.preventDefault()
    return false
  
  playerInventory = new Inventory(10)
  currentInventorySlot = 0
  toolbar = createToolbar {el: '#tools'}
  toolbar.on 'select', (slot) =>
    currentInventorySlot = slot

  reach.on 'interact', (target) =>
    if not target
      console.log 'waving'
      return

    currentItemPile = playerInventory.slot(currentInventorySlot)
    currentMaterial = currentItemPile.item
    currentBlockID = registry.getBlockID(currentMaterial)

    game.createBlock target.adjacent, currentBlockID
    #game.setBlock target.voxel, 0
    # TODO: other interactions depending on item (ex: click button, check target.sub; or other interactive blocks)

