Closed Mykola1453 closed 10 months ago
any thoughts @LetsChill ?
Do we have any updates on this? @rom1504 @LetsChill @Mykola1453
@rom1504 can we merge this?
@Mykola1453 Using your branch with autoVersionForge gives this result to me:
Using forgeMods: []
other loginwrapperchannel quark:main received
{"translate":"multiplayer.disconnect.slow_login"} false
@Maud-Pie, thanks for noticing. My recent commits should have fixed this.
As it reads from your log, this is due to Quark mod. Since October (version 410+), the mod now sends a custom packet upon login and waits for a response from the client. If no response is given, mineflayer bot won't connect and gives a timed out error.
Using the mod's source code as reference, I fixed this error quickly. I just wrote so that the bot, upon receiving the Quark packet, sends acknowledgment.
I wasn't sure I had to modify forgeHandshake3.js and fml3.json files for this, given that it's mod behavior and not Forge's. However, this mod is quite popular, whereas the change is not that big and doesn't seem to break anything if there's no Quark mod. So while there may be a more elegant way to fix this, this works too.
On an unrelated note, I also encountered an error with mineflayer itself, when I connected to a server with some mods. Specifically, with ...\mineflayer\lib\plugins\entities.js file and TeamAbnormals mods. Fix is a simple if statement around entity.type = entityData.type || 'object'
line. I created mineflayer PR that does that https://github.com/PrismarineJS/mineflayer/pull/3254
merging
would be really great to have some CI here, otherwise it will keep breaking
/makerelease
/makerelease
There are still come kinks, but here's my pull request for FML3.
Firstly, I compared fml3.json file with Forge source code, fixing mappings numbers in fml_handshake and adding description for ModData and ChannelMismatchData (not sure if needed, added just in case), and removing modCount and channelCount in ModListReply (not sure what it does, but having it breaks my version of forgeHandshake3.js) .
Secondly, forgeHandshake3.js file.
As I understand, @LetsChill's approach was to use messageId instead of discriminator to determine when to send an Acknowledgement Packet. However, the issue here is that sometimes it needs to send Acknowledgement to more messages than specified in the code. LetsChill's code worked perfectly with Forge and no mods, but when I started adding mods (for example, Biomes O' Plenty and other mods from Forstride), bot couldn't connect, the connection timed out. Only when I replaced
if (data.messageId > 1 && data.messageId < 21)
withif (data.messageId > 1 && data.messageId < 23)
(so to send the packet to any message with ID from 2 to 22), it worked. I'm not sure why or how it works, seems arbitrary to me. After adding some other mods, I couldn't connect without upping that number again, so the number seems arbitrary too.In short, I couldn't figure how to work with LetsChill's code and resorted to the use of forgeHandshake2.js as I understood it better. I used that file as a template, adding necessary changes to make it work with FML3. I'm not sure how critical, but it adds an error in server's console:
[ne.mi.ne.HandshakeHandler/FMLHANDSHAKE]: Recieved unexpected index 0 in client reply
. This doesn't seem to influence the bot, but the error is absent when using LetsChill's code (with changes above needed to connect), so there are benefits in using LetsChill's version of the file (if messageId can be figured out).Another thing I couldn't figure is that both mine and LetsChill's code lead to this error, when trying to connect to the local game with some mods (like Mekanism ones) installed:
Error: Deserialization error for play.toClient : Read error for undefined : unexpected tag end ...
. The error is absent when using the same mods, but on server instead of opening singleplayer to LAN. I'm sure there are other kinks, but those are ones I noticed.Finally, I added examples of using mineflayer with FML3, one with the logic needed to connect to the server with SimpleLogin mod, one without it.