/*
 * This example demonstrates how easy it is to create a bot
 * that fetches monster spawners mob type
 */
const mineflayer = require('mineflayer')

if (process.argv.length < 4 || process.argv.length > 6) {
  console.log('Usage : node block_entity.js <host> <port> [<name>] [<password>]')
  process.exit(1)
}

const bot = mineflayer.createBot({
  host: process.argv[2],
  port: parseInt(process.argv[3]),
  username: process.argv[4] ? process.argv[4] : 'block_entity',
  password: process.argv[5]
})

let mcData
bot.on('inject_allowed', () => {
  mcData = require('minecraft-data')(bot.version)
})

bot.on('message', (cm) => {
  if (cm.toString().includes('spawner')) {
    spawner()
  }
})

function spawner () {
  const block = bot.findBlock({
    matching: mcData.blocksByName.mob_spawner.id,
    point: bot.entity.position
  })

  if (!block) {
    return bot.chat('Monster spawner not found')
  }

  bot.chat(`Entity type: ${block.blockEntity.SpawnData.id}`)
  bot.chat(`Delay: ${block.blockEntity.Delay}`)
  console.log(block.blockEntity)
}

@@ -705,24 +705,185 @@
 pawner () %7B%0A
+  if (bot.majorVersion === '1.8' %7C%7C bot.majorVersion === '1.9' %7C%7C bot.majorVersion === '1.10' %7C%7C bot.majorVersion === '1.11' %7C%7C bot.majorVersion === '1.12') %7B%0A  
   const bloc
@@ -902,16 +902,18 @@
 Block(%7B%0A
+  
     matc
@@ -958,16 +958,18 @@
 id,%0A    
+ 
+ 
 point: b
@@ -989,18 +989,160 @@
 ition%0A  
-%7D)
+  %7D)%0A  %7D else %7B%0A    const block = bot.findBlock(%7B%0A      matching: mcData.blocksByName.spawner.id,%0A      point: bot.entity.position%0A    %7D)%0A  %7D%0A  
 %0A%0A  if (

Fix spawner