File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99const mineflayer = require ( 'mineflayer' )
1010
1111if ( process . argv . length < 4 || process . argv . length > 6 ) {
12- console . log ( 'Usage : node echo.js <host> <port> [<name>] [<password> ]' )
12+ console . log ( 'Usage : node echo.js <host> <port> [<name>] [online? ]' )
1313 process . exit ( 1 )
1414}
1515
1616const bot = mineflayer . createBot ( {
1717 host : process . argv [ 2 ] ,
1818 port : parseInt ( process . argv [ 3 ] ) ,
1919 username : process . argv [ 4 ] ? process . argv [ 4 ] : 'echo' ,
20- password : process . argv [ 5 ]
20+ auth : process . argv [ 5 ] ? 'microsoft' : 'offline'
2121} )
2222
2323bot . on ( 'chat' , ( username , message ) => {
2424 if ( username === bot . username ) return
2525 bot . chat ( message )
2626} )
27+
28+ bot . on ( 'kicked' , ( reason ) => {
29+ console . log ( 'I was kicked from the server: ' + reason )
30+ } )
Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ function inject (bot, options) {
5555 if ( packet . worldType && ! bot . game . dimension ) {
5656 bot . game . dimension = packet . worldType . replace ( 'minecraft:' , '' )
5757 }
58- console . log ( '*Dimension data' , bot . game . dimension , bot . registry . dimensionsByName , packet )
5958 const dimData = bot . registry . dimensionsByName [ bot . game . dimension ]
6059 if ( dimData ) {
6160 bot . game . minY = dimData . minY
@@ -79,7 +78,6 @@ function inject (bot, options) {
7978
8079 // 1.20.2
8180 bot . _client . on ( 'registry_data' , ( packet ) => {
82- console . log ( 'Loading Dimension Codec' , JSON . stringify ( packet ) . slice ( 0 , 100 ) )
8381 bot . registry . loadDimensionCodec ( packet . codec || packet )
8482 } )
8583
You can’t perform that action at this time.
0 commit comments