25 lines
639 B
JavaScript
25 lines
639 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)
|
|
})
|
|
|
|
bot.supportFeature = feature => bot.registry.supportFeature(feature)
|
|
}
|
|
|
|
module.exports = inject
|