prismarine-viewer
Web based viewer
Last updated a month ago by rom1504 .
MIT · Original npm · Tarball · package.json
$ cnpm install prismarine-viewer 
SYNC missed versions from official npm registry.

prismarine-viewer

Web based viewer for servers and bots

NPM version Build Status Discord Gitter Irc

Try it on gitpod

viewer

Install

npm install prismarine-viewer

Example

const mineflayer = require('mineflayer')
const mineflayerViewer = require('prismarine-viewer').mineflayer

const bot = mineflayer.createBot({
  username: 'Bot'
})

bot.once('spawn', () => {
  mineflayerViewer(bot, { port: 3000 }) // Start the viewing server on port 3000

  // Draw the path followed by the bot
  const path = [bot.entity.position.clone()]
  bot.on('move', () => {
    if (path[path.length - 1].distanceTo(bot.entity.position) > 1) {
      path.push(bot.entity.position.clone())
      bot.viewer.drawLine('path', path)
    }
  })
})

API

All drawing function have a unique id that can be used to replace or erase the primitive.

bot.viewer.drawLine (id, points, color=0xff0000)

Draw a line passing through all the points.

bot.viewer.erase (id)

Remove the primitive with the given id from the display.

Tests

node_modules/.bin/jest --verbose --runInBand --forceExit -t "1.16.1"

Current Tags

  • 1.6.0                                ...           latest (a month ago)

12 Versions

  • 1.6.0                                ...           a month ago
  • 1.5.0                                ...           2 months ago
  • 1.4.0                                ...           3 months ago
  • 1.3.0                                ...           3 months ago
  • 1.2.2                                ...           4 months ago
  • 1.2.1                                ...           4 months ago
  • 1.2.0                                ...           4 months ago
  • 1.1.0                                ...           4 months ago
  • 1.0.3                                ...           4 months ago
  • 1.0.2                                ...           4 months ago
  • 1.0.1                                ...           4 months ago
  • 1.0.0                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 11
Dependencies (13)
Dev Dependencies (8)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |