24 lines
567 B
JavaScript
24 lines
567 B
JavaScript
|
const loadRegistry = require('prismarine-registry')
|
||
|
|
||
|
function inject (bot) {
|
||
|
function next () {
|
||
|
bot.registry = loadRegistry(bot._client.version)
|
||
|
bot.emit('registry_loaded')
|
||
|
}
|
||
|
|
||
|
bot.on('set_client', client => {
|
||
|
if (client.wait_connect) client.once('connect_allowed', next)
|
||
|
else next()
|
||
|
})
|
||
|
|
||
|
bot.on('packet.login', packet => {
|
||
|
if (packet.dimensionCodec) bot.registry.loadDimensionCodec(packet.dimensionCodec)
|
||
|
})
|
||
|
|
||
|
bot.on('packet.registry_data', packet => {
|
||
|
bot.registry.loadDimensionCodec(packet.codec)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
module.exports = inject
|