How to use the minecraft-data.version function in minecraft-data

To help you get started, we’ve selected a few minecraft-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrismarineJS / mineflayer / index.js View on Github external
function next () {
      const version = require('minecraft-data')(self._client.version).version
      if (supportedVersions.indexOf(version.majorVersion) === -1) {
        throw new Error(`Version ${version.minecraftVersion} is not supported.`)
      }
      self.protocolVersion = version.version
      self.majorVersion = version.majorVersion
      self.version = version.minecraftVersion
      options.version = version.minecraftVersion
      self.emit('inject_allowed')
    }
  }