CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PrismarineJS

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: PrismarineJS/mineflayer
Path: blob/master/examples/skin_blinker.js
Views: 789
1
/*
2
* Since 1.8 the players skin can have a second layer over their whole skin.
3
*
4
* This example will toggle that layer every half second, making your skin 'blick'
5
* (If your bots skin has a second layer)
6
*/
7
const mineflayer = require('mineflayer')
8
9
if (process.argv.length < 4 || process.argv.length > 6) {
10
console.log('Usage : node skin_blinker.js <host> <port> [<name>] [<password>]')
11
process.exit(1)
12
}
13
14
const bot = mineflayer.createBot({
15
host: process.argv[2],
16
port: parseInt(process.argv[3]),
17
username: process.argv[4] ? process.argv[4] : 'skin_blinker',
18
password: process.argv[5]
19
})
20
21
let show = true
22
23
function toggleSkin () {
24
show = !show
25
bot.setSettings({
26
skinParts: {
27
showJacket: show,
28
showHat: show,
29
showRightPants: show,
30
showLeftPants: show,
31
showLeftSleeve: show,
32
showRightSleeve: show
33
}
34
})
35
}
36
37
bot.on('spawn', () => {
38
setInterval(toggleSkin, 500)
39
})
40
41