PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.9k stars 899 forks source link

Running any example after installation #683

Closed Leftier closed 5 years ago

Leftier commented 6 years ago

I'm using windows 10 with node 8.11.3, npm 6.1.0 and minecraft 1.12.2 Just finished installing mineflayer@2.7.3 and tried to execute node echo.js, I tried vanilla an non-vanilla servers, servers with specific ports or default (25565) but I always get this error and the "Chunk size" with different values depending on the server.

So I tried with another file, jumper.js but still the same error. Also tried the following code to see If I could get a different message

bot.on('uncaughtException', function(err) {
  console.log(err)
})

Error:

{ Error: querySrv ENOTFOUND _minecraft._tcp.play.wildercraft.net
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.play.wildercraft.net' }
{ Error: querySrv ENOTFOUND _minecraft._tcp.play.wildercraft.net
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.play.wildercraft.net' }
Chunk size is 10 but only 2 was read ; partial packet : {"name":"combat_event","params":{"event":0}}; buffer :2c003d4ccccd3dcccccd
Leftier commented 6 years ago

I added this line as suggested in issue#604 checkTimeoutInterval: (25 * 10000) So I tried again with jumper.js and got the same error but not the chunk size one:

{ Error: querySrv ENOTFOUND _minecraft._tcp.vnlla.net
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.vnlla.net' }
{ Error: querySrv ENOTFOUND _minecraft._tcp.vnlla.net
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.vnlla.net' }

So I could execute a command in chat but after doing so the following error occurs:

C:\Users\-USER-\Desktop\test\node_modules\minecraft-protocol\src\transforms\framing.js:66
          } else { throw e }
                   ^

And the bot just leaves the game

rom1504 commented 6 years ago

What minecraft version ? What kind of server ?

On Sat, Jun 30, 2018, 17:01 Leftier notifications@github.com wrote:

I added this line as suggested in issue#123

So I tried again with jumper.js and got the same error but not the chunk size one:

{ Error: querySrv ENOTFOUND _minecraft._tcp.vnlla.net at errnoException (dns.js:50:10) at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19) code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'querySrv', hostname: '_minecraft._tcp.vnlla.net' } { Error: querySrv ENOTFOUND _minecraft._tcp.vnlla.net at errnoException (dns.js:50:10) at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19) code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'querySrv', hostname: '_minecraft._tcp.vnlla.net' }

So I could execute a command in chat but after doing so the following error occurs:

C:\Users-USER-\Desktop\test\node_modules\minecraft-protocol\src\transforms\framing.js:66 } else { throw e } ^

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/683#issuecomment-401546474, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_kFySY4bHS-FrUmLhIgupx22ortVks5uB5LUgaJpZM4U9_lc .

Leftier commented 6 years ago

On the first post:

I'm using windows 10 with node 8.11.3, npm 6.1.0 and minecraft 1.12.2 Just finished installing mineflayer@2.7.3 and tried to execute node echo.js, I tried vanilla an non-vanilla servers, servers with specific ports or default (25565) but I always get this error and the "Chunk size" with different values depending on the server.

lewisakura commented 6 years ago

I have a feeling that it's because the library disregards the fact that a server may not have a _minecraft._tcp SRV record.

Tried this myself with play.pvpwars.net and it doesn't work.

lewisakura commented 6 years ago

I found a workaround and it won't work on all servers, but if your server works with 1.8 then just set the version to 1.8.

rom1504 commented 6 years ago

This problem is probably happening because of some specific plugins in your server. What server is it ?

It's not possible to solve the problem for us without being able to reproduce it.

rom1504 commented 6 years ago

https://github.com/PrismarineJS/mineflayer/blob/master/docs/issue_template.md

unixfox commented 6 years ago

I've the same error as @Leftier with the example ansi. I tried on the server: us.stratus.network which accept the minecraft versions from 1.7 to 1.13 (using the plugin ViaVersion). Here are the logs:

{ Error: querySrv ENOTFOUND _minecraft._tcp.us.stratus.network
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.us.stratus.network' }
{ Error: querySrv ENOTFOUND _minecraft._tcp.us.stratus.network
    at errnoException (dns.js:50:10)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:238:19)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_minecraft._tcp.us.stratus.network' }
Chunk size is 10 but only 2 was read ; partial packet : {"name":"combat_event","params":{"event":13}}; buffer :2c0d3d4ccccd3dcccccd
unixfox commented 6 years ago

I found the issue, mineflayer can't detect the version of the server and by using version:"1.8" I was able to resolve the issue.