PrismarineJS / mineflayer

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

Two errors #479

Closed TheTechPony closed 7 years ago

TheTechPony commented 7 years ago

A fresh install of mineflayer and minecraft-protocol cause me to get this error https://gyazo.com/c26c38f466f1bde71d639d1abd659cbd.png

And when I somehow got it to work the chat even wasn't working.

TheTechPony commented 7 years ago

didnt mean to close it https://i.gyazo.com/d6f0585285bb9b21af91a7f1c6604329.png

rom1504 commented 7 years ago

What version are you connecting to ?

rom1504 commented 7 years ago

might be related to https://github.com/PrismarineJS/node-minecraft-protocol/issues/464 (84) is it a custom server ? (server with plugins etc ?)

TheTechPony commented 7 years ago

I got it to work now but the chat event isn't working still.

It's this server right now if you want to come on and look: play.mineraze.us

TheTechPony commented 7 years ago

This is my code currently http://pastebin.com/MpZV24UA

rom1504 commented 7 years ago

About the chat event, see https://github.com/PrismarineJS/mineflayer/blob/master/examples/chatAddPattern.js

TheTechPony commented 7 years ago

So I have to add chat patterns for every server? How do I get the raw chat data? I can't seem to get it to work still.

rom1504 commented 7 years ago

you can use https://github.com/PrismarineJS/mineflayer/blob/master/doc/api.md#message-jsonmsg

Yes you have to add chat patterns for server for use a particular chat plugin, because they have their own chat format

TheTechPony commented 7 years ago

I've fixed a majority of my issues but I don't understand what I'm looking at when it comes to minecraft regex. I've googled around and can't find much of anything.

rom1504 commented 7 years ago

what is displayed when you do bot.on('message',message => console.log(message)) ?

TheTechPony commented 7 years ago

https://gyazo.com/d488bf3c43409d5d8514100f93685d73 If I could just get a small push in the right direction I'd be able to teach myself but I've never worked with regex before

rom1504 commented 7 years ago

Can you use http://pastebin.com/ and copy paste instead of posting screenshots ? can you post the result of bot.on('message',message => console.log(JSON.stringify(message,null,2)))

The idea is to see what the messages look like, so we can extract the content from it.

TheTechPony commented 7 years ago

There's a whisper at the bottom http://pastebin.com/x0LevtYK

TheTechPony commented 7 years ago

I thought I found a workaround but it wouldn't let me pull usernames. If you could link me to some resources then I'm sure I'd be able to figure it out on my own. I've copied the raw message into regexr.com but I don't know how to deal with the color signs

TheTechPony commented 7 years ago

After some intensive google'ing I've solved my issue. Thanks for the support. :+1: