@@ -15,6 +15,7 @@ export default () => {
1515 registerMediaChannels ( )
1616 registerSectionAnimationChannels ( )
1717 registeredJeiChannel ( )
18+ registerBlockInteractionsCustomizationChannel ( )
1819 } )
1920}
2021
@@ -32,6 +33,36 @@ const registerChannel = (channelName: string, packetStructure: any[], handler: (
3233 console . debug ( `registered custom channel ${ channelName } channel` )
3334}
3435
36+ const registerBlockInteractionsCustomizationChannel = ( ) => {
37+ const CHANNEL_NAME = 'minecraft-web-client:block-interactions-customization'
38+ const packetStructure = [
39+ 'container' ,
40+ [
41+ {
42+ name : 'newConfiguration' ,
43+ type : [ 'pstring' , { countType : 'i16' } ]
44+ } ,
45+ ]
46+ ]
47+
48+ registerChannel ( CHANNEL_NAME , packetStructure , ( data ) => {
49+ const config = JSON . parse ( data . newConfiguration )
50+ if ( config . customBreakTime !== undefined && Object . values ( config . customBreakTime ) . every ( x => typeof x === 'number' ) ) {
51+ bot . mouse . customBreakTime = config . customBreakTime
52+ }
53+ if ( config . customBreakTimeToolAllowance !== undefined ) {
54+ bot . mouse . customBreakTimeToolAllowance = new Set ( config . customBreakTimeToolAllowance )
55+ }
56+
57+ if ( config . blockPlacePrediction !== undefined ) {
58+ bot . mouse . settings . blockPlacePrediction = config . blockPlacePrediction
59+ }
60+ if ( config . blockPlacePredictionDelay !== undefined ) {
61+ bot . mouse . settings . blockPlacePredictionDelay = config . blockPlacePredictionDelay
62+ }
63+ } , true )
64+ }
65+
3566const registerBlockModelsChannel = ( ) => {
3667 const CHANNEL_NAME = 'minecraft-web-client:blockmodels'
3768
0 commit comments