@@ -21,6 +21,7 @@ export default () => {
2121 customEvents . on ( 'mineflayerBotCreated' , async ( ) => {
2222 if ( ! getIsCustomChannelsEnabled ( ) ) return
2323 bot . once ( 'login' , ( ) => {
24+ registerConnectMetadataChannel ( )
2425 registerBlockModelsChannel ( )
2526 registerMediaChannels ( )
2627 registerSectionAnimationChannels ( )
@@ -48,6 +49,25 @@ const registerChannel = (channelName: string, packetStructure: any[], handler: (
4849 console . debug ( `registered custom channel ${ channelName } channel` )
4950}
5051
52+ const registerConnectMetadataChannel = ( ) => {
53+ const CHANNEL_NAME = 'minecraft-web-client:connect-metadata'
54+ const packetStructure = [
55+ 'container' ,
56+ [
57+ { name : 'metadata' , type : [ 'pstring' , { countType : 'i16' } ] }
58+ ]
59+ ]
60+
61+ bot . _client . registerChannel ( CHANNEL_NAME , packetStructure , true )
62+ bot . _client . writeChannel ( CHANNEL_NAME , {
63+ metadata : JSON . stringify ( {
64+ version : process . env . RELEASE_TAG ,
65+ build : process . env . BUILD_VERSION ,
66+ ...window . serverMetadataConnect ,
67+ } )
68+ } )
69+ }
70+
5171const registerBlockInteractionsCustomizationChannel = ( ) => {
5272 const CHANNEL_NAME = 'minecraft-web-client:block-interactions-customization'
5373 const packetStructure = [
0 commit comments