Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PrismarineJS
GitHub Repository: PrismarineJS/mineflayer
Path: blob/master/lib/plugins/spawn_point.js
9427 views
1
const { Vec3 } = require('vec3')
2
3
module.exports = inject
4
5
function inject (bot) {
6
bot.spawnPoint = new Vec3(0, 0, 0)
7
bot._client.on('spawn_position', (packet) => {
8
const pos = bot.supportFeature('spawnPositionIsGlobal') ? packet.globalPos.location : packet.location
9
bot.spawnPoint = new Vec3(pos.x, pos.y, pos.z)
10
bot.emit('game')
11
})
12
}
13
14