Closed Darker closed 4 years ago
Can you use '''js instead of ''' to have syntax highlighting ?
I'm pretty sure the problem is with "Wait 3 second for chest to open" : why are you waiting 3 seconds ? Use the events of the chest ;) Look at https://github.com/andrewrk/mineflayer/blob/master/examples/chest.js#L87
The reason why it would work on localhost but not on an online server is probably lag.
You misunderstood: What I do is that if the open operation does not call the event within 3 seconds, the bot asumes that something's wrong. And as I said, it manages to put certain ammout of items in chest - and never fails when playing on localhost.
Oh yeah ok I understand. What kind of server are you connecting to ? do you get the same result with a vanilla server ? I think it might be possible you're not getting a confirmTransaction packet in your server, so the callback in clickWindow might never be called https://github.com/andrewrk/mineflayer/blob/master/lib/plugins/inventory.js#L350
seems it's not an issue
I created a program to clear all useless items in nearby chest. The core of it uses the
async
framework and looks like this:The problem is that while on localhost this never fails and really clears all items to chest (unless the chest is full, but even then it reports error and ends), on online servers it goes stuck at certain point. When I disconnect the player, one stack of items is dropped. Any idea where should I search the point where it freezes?
Typical output on localhost:
On online server, it goes stuck after calling deposit - the deposit's callback is never called so I see:
and that's over. It also usually manages to stuff some items in chest before going stuck.