PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

noteHeard event not passing correct data #1003

Closed msf567 closed 4 years ago

msf567 commented 4 years ago

Versions

Detailed description of a problem

noteHeard event is not passing accurate data. instrument name is always harp and pitch is always 0

Current code

bot.on('noteHeard',(block,instrument,pitch)=>
{

  bot.chat(`Music for my ears! I just heard a ${instrument.name}`)
  bot.chat('i hear a note at pitch ' + pitch)
  if(pitch == '10')
  {
    bot.setControlState('jump', true)
    bot.setControlState('jump', false)
  }
})

Expected behavior

instrument pitch and type should be accurate to the block

Additional context

Karang commented 4 years ago

Indeed, the way to retreive the note changed in 1.13 https://wiki.vg/Block_Actions#Note_Block This needs to be fixed here: https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/block_actions.js#L13

rom1504 commented 4 years ago

fixed