Closed imharvol closed 4 years ago
The condition for spawn seems to be incorrect, you can fix it https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/health.js#L20
However why do you want to use the spawn event ?
n Sat, Feb 23, 2019, 14:42 ImHarvol notifications@github.com wrote:
it's possible your server doesn't send the update_health packet and hence spawn doesn't get emitted https://github.com/PrismarineJS/mineflayer/blob/7e3da452d6c75b44b612f8c174700699687d7495/lib/plugins/health.js#L11
Originally posted by @rom1504 https://github.com/rom1504 in #749 (comment) https://github.com/PrismarineJS/mineflayer/issues/749#issuecomment-441462483
This is my code:
const mineflayer = require('mineflayer');const navigatePlugin = require('mineflayer-navigate')(mineflayer);const vec3 = require('vec3') let bot = mineflayer.createBot({ host: "localhost", port: 25565, username: "testing", version:"1.12.2" }); bot.on('spawn', () => { bot.chat('I spawned, watch out!') }) bot._client.on('update_health', (packet) => { console.log(packet) })
But even though I'm receiving the update_health packet, the spawn event never gets triggered.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/783, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_pf-0FeYudcsMA98-Wemp5V6hfFaks5vQUU0gaJpZM4bN80G .
Similar problem here - happening on non-vanilla servers, except the spawn event is only emitted when you join for the first time. Bot logs in and appears in the server the next time the bot is ran, but it never again fires "spawn" until I point it to a different server. Similar code to OP.
The solution has already been given
On Fri, Mar 1, 2019, 11:27 safazi notifications@github.com wrote:
Similar problem here - happening on non-vanilla servers, except the spawn event is only emitted when you join for the first time. Bot logs in and appears in the server the next time the bot is ran, but it never again fires "spawn" until I point it to a different server. Similar code to OP.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/783#issuecomment-468529005, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_ryhKN45tgoYWRtLweJLUD25qSkjks5vSJ4ogaJpZM4bN80G .
Same behavior for me, the spawn
event is never triggered. It appears that the event stopped to work when the 2.7.4
version of Mineflayer was introduced.
I've tried on both vanilla and Spigot minecraft server (1.12.2).
The solution has already been given.
On Sun, Mar 3, 2019, 04:26 Emilien Devos notifications@github.com wrote:
Same behavior for me, the spawn event is never triggered. It appears that the event stopped to work when the 2.7.4 version of Mineflayer was introduced. I've tried on both vanilla and Spigot minecraft server (1.12.2).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/783#issuecomment-468957047, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_s9reO_9ubVIqDb_IQLKA2W2vm8Wks5vSt57gaJpZM4bN80G .
This issue also occurs for me even with the solution. When the bot joins the server for the first time the spawn / respawn events do not get called.. I've got a work around on the login event I wait 2500 ms before emitting the spawn event.
It's not the best way to solve this but once the spawn event has fired once it works fine without issues. If I don't fire the spawn event manually other events will not run for me.
The issue could also be due to my lack of knowledge around node.js
Can your PR what you changed, so we can check it's correct ?
On Wed, Mar 6, 2019, 21:45 tryzombie501 notifications@github.com wrote:
This issue also occurs for me even with the solution. When the bot joins the server for the first time the spawn / respawn events do not get called.. I've got a work around on the login event I wait 2500 ms before emitting the spawn event.
It's not the best way to solve this but once the spawn event has fired once it works fine without issues. If I don't fire the spawn event manually other events will not run for me.
The issue could also be due to my lack of knowledge around node.js
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/783#issuecomment-470112358, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_o-WcxT4-g2hfrB4YtVNM3jH-LbKks5vT8Z9gaJpZM4bN80G .
it's possible your server doesn't send the update_health packet and hence spawn doesn't get emitted https://github.com/PrismarineJS/mineflayer/blob/7e3da452d6c75b44b612f8c174700699687d7495/lib/plugins/health.js#L11
Originally posted by @rom1504 in https://github.com/PrismarineJS/mineflayer/issues/749#issuecomment-441462483
This is my code:
But even though I'm receiving the _updatehealth packet, the spawn event never gets triggered.