@djmahirnationtv/prismarine-viewer
v1.33.9
Published
Web based viewer with fixed Nametags, Skins and 3D Rendering Animations
Readme
prismarine-viewer | @djmahirnationtv
Web based viewer for servers and bots
What has been changed?:
1.33.8
- Skins Support (Also supports Offline Servers and Online Servers)
- Better Nametag reading
1.33.9
- Added Camera rendering:
mineflayerViewer(bot, {
port: 3000,
firstPerson: false,
debugCamera: false,
lockCamera: true,
cameraPosition: { x: 58.04, y: 111.89, z: -63.22 },
cameraRotation: { yaw: -2.15, pitch: -0.57 }
})- cameraPosition: { x: 0, y: 0, z: 0 }
- cameraRotation: { yaw: 0, pitch: 0 }
- lockCamera: true/false --> Locking the Camera / disabling the camera movement
- debugCamera: true/false --> Camera Position debugging
[](https://djmahirnationtv.com
Supports versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2, 1.14.4, 1.15.2, 1.16.1, 1.16.4, 1.17.1, 1.18.1, 1.19, 1.20.1, 1.21.1, 1.21.4.
Install
npm install @djmahirnationtv/prismarine-viewerExample
const mineflayer = require('mineflayer')
const mineflayerViewer = require('@djmahirnationtv/prismarine-viewer').mineflayer
const bot = mineflayer.createBot({
username: 'DJMahirNationTV'
})
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
@djmahirnationtv/prismarine-viewer
viewer
The core rendering library. It provides Viewer and WorldView which together make it possible to render a minecraft world. Check its API
mineflayer
Serve a webserver allowing to visualize the bot surrounding, in first or third person. Comes with drawing functionnalities.
const { mineflayer } = require('@djmahirnationtv/prismarine-viewer')Options:
viewDistanceview radius, in chunks, default:6firstPersonis the view first person ? default:falseportthe port for the webserver, default:3000
standalone
Serve a webserver allowing to visualize a world.
const { standalone } = require('@djmahirnationtv/prismarine-viewer')Options:
versionthe version to use, default:1.13.2generatora world generator function, default:(x, y, z) => 0centera vec3 to center the view on, default:new Vec3(0, 0, 0)viewDistanceview radius, in chunks, default:6portthe port for the webserver, default:3000
headless
Render the bot view and stream it to a file or over TCP.
const { headless } = require('@djmahirnationtv/prismarine-viewer')Options:
viewDistanceview radius, in chunks, default:6outputthe output file or ahost:portaddress to stream to, default:output.mp4framesnumber of frames to record,-1for infinite, default:200widththe width of a frame, default:512heightthe height of a frame, default:512
Drawing (mineflayer mode)
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.
bot.viewer.close ()
Stop the server and disconnect users.
