@@ -15,6 +15,7 @@ export default () => {
15
15
registerMediaChannels ( )
16
16
registerSectionAnimationChannels ( )
17
17
registeredJeiChannel ( )
18
+ registerBlockInteractionsCustomizationChannel ( )
18
19
} )
19
20
}
20
21
@@ -32,6 +33,36 @@ const registerChannel = (channelName: string, packetStructure: any[], handler: (
32
33
console . debug ( `registered custom channel ${ channelName } channel` )
33
34
}
34
35
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
+
35
66
const registerBlockModelsChannel = ( ) => {
36
67
const CHANNEL_NAME = 'minecraft-web-client:blockmodels'
37
68
0 commit comments