-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathexample.js
27 lines (23 loc) · 884 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* This example starts a web server on localhost:3000 with a live representation
* of the inventory of the Mineflayer bot
*
* Get this example from: https://raw.githubusercontent.com/ImHarvol/mineflayer-web-inventory/master/example.js
* Install dependencies: npm i mineflayer mineflayer-web-inventory
*
* Usage: node example.js [<host>] [<port>] [<name>] [<password>]
*/
const mineflayer = require('mineflayer')
const inventoryViewer = require('mineflayer-web-inventory')
// const inventoryViewer = require('./index')
if (process.argv.length > 6) {
console.log('Usage : node example.js [<host>] [<port>] [<name>] [<password>]')
process.exit(1)
}
const bot = mineflayer.createBot({
host: process.argv[2] || 'localhost',
port: parseInt(process.argv[3]) || 25565,
username: process.argv[4] || 'web-inventory',
password: process.argv[5]
})
inventoryViewer(bot)