-
-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'spawn' event never gets triggered #749
Comments
Put the bot.once('spawn', () => { outside of the bot.once('login', () => { |
Even if i delete the part of the bot.once('spawn', () => { Code atm:
Output is still: BOT betritt den Server |
ok can you do that https://github.com/PrismarineJS/mineflayer/blob/master/docs/README.md#debug and report the debug log here |
it's possible your server doesn't send the update_health packet and hence spawn doesn't get emitted mineflayer/lib/plugins/health.js Line 11 in 7e3da45
|
soo this is the complete debug log. Hope there issnt any sensitive data wich i sould delete. |
Indeed no update_health packet. We should probably emit spawn in other conditions too. Anyway, do something like that :
|
How do i integrate that piece of code into mine? |
Got it .. but sending a msg in chat afterwards throws an error: minecraft-protocol writing packet login.chat +311ms
|
"msg in chat afterwards" when is "afterwards" ? |
So with ur piece of code the 'spawn' event gets triggered. And im getting the output from: but in the next line I try to send a chatmsg. Wich is 'afterwards'. After the Spawn event. Wich is throwing the error above Thanks for ur help btw. Apreciate it! |
Ok hmm. Try to increase 1000 to something like 10000 ? |
That worked for me. Thanks a lot :D Just installed the mineflayer-navigate plugin. With
so.. In what format do I have to write the coordinate into the parentheses? |
Vec3
const Vec3 = require ('vec3').Vec3
new Vec3(1,2,3)
…On Mon, Nov 26, 2018, 15:08 Ceeekaay ***@***.***> wrote:
That worked for me. Thanks a lot :D
Now im able to connect to a server and chat x)
Next step is simple movement.
Just installed the mineflayer-navigate plugin.
I want the bot to move to a specific point (XYZ 318 116 280)
With
bot.navigate.to(point)
i should be able to do it.
But in the documentation is just written:
point - the block you want your feet to be standing on
so.. In what format do I have to write the coordinate into the parentheses?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#749 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACPN_qL_B2N3ztgfGGqzR4cpI6iL7CzCks5uy_XggaJpZM4Yx_YF>
.
|
The bot gets into the portal room. It walks 2 blocks and jumps .. i get the output "Ziel erreicht" wich means the bot thinks he triggered the arrive event, wich issnt true. |
Is the position accessible ?
…On Mon, Nov 26, 2018, 17:41 Ceeekaay ***@***.***> wrote:
const mineflayer = require('mineflayer')
const navigatePlugin = require('mineflayer-navigate')(mineflayer);
const Vec3 = require ('vec3').Vec3
const bot = mineflayer.createBot({
host: "team.griefergames.net",
port: null,
username: "xxx",
password: "xxx",
version: "1.8",
verbose: true
})
navigatePlugin(bot);
bot.navigate.on('cannotFind', function (closestPath) {
console.log("Weg nicht gefunden. Closest Path")
bot.navigate.walk(closestPath);
});
bot.navigate.on('arrived', function () {
console.log("ZIEL ERREICHT!")
bot.setControlState('jump', true);
});
bot.navigate.on('interrupted', function() {
console.log("Wegfindung unterbrochen")
});
setTimeout(() => {
bot.isAlive = true
bot.emit('spawn')
}, 10000)
console.log("BOT betritt den Server");
bot.once('spawn', () => {
console.log("Bot is eingeloggt");
console.log(bot.username);
console.log("Bot befindet sich im /hub")
bot.chat("/portal")
bot.once('spawn', () => {
console.log("Bot befindet sich im Portalraum")
//bot.setControlState('jump', true)
bot.navigate.to(new Vec3(315,116,282))
console.log(bot.entity.position)
})
})
The bot gets into the portal room. It walks 2 blocks and jumps .. i get
the output "Ziel erreicht" wich means the bot thinks he triggered the
arrive event, wich issnt true.
You got any idea?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#749 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACPN_tdmCDLQawv2HCCz2BHMJpfWEWQpks5uzBmogaJpZM4Yx_YF>
.
|
Ye it is. the coordinates i entered are right in front of the portal with the emerald blocks on the left. |
Ah you've got a lot of special blocks there...
Can you check whether it works better for you on a simple terrain ?
If it does, can you check that the bounding boxes of all the blocks you got
there are properly defined in Minecraft-data ?
…On Mon, Nov 26, 2018, 18:48 Ceeekaay ***@***.***> wrote:
Ye it is.
https://imgur.com/GHXDWeK
the coordinates i entered are right in front of the portal with the
emerald blocks on the left.
CeeekaayJr is the bot i try to controll x) Hes just jumping there.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#749 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACPN_jcvvZuUAFb_nySFHeevMvwwaUOPks5uzClogaJpZM4Yx_YF>
.
|
What are special blocks for ya? I checked every block. If i go on a local flat server with just gras the navigate to is workin like a charm. |
I'm not asking you to check whether it's present, but whether its boundingBox field is properly defined as "block". Mineflayer doesn't handle any bounding box that isn't a simple cube or empty. In your case there seem to be some blocks with part of cube. See #228 |
Ye you are right! It did the trick for me to use some jumps in between the steps of navigating wich made the bot touching the ground for some time and then continuing its path. I look forward to see an updatet version of the bouding boxes! Thank you so much for your help! |
Got my Code running on windows10
On my RasPi it issnt working. npm v6.4.1 Its starting on my Pi and connecting to the Server. But somehow the mineflayer-navigate lib issnt workin.
But the Bot issnt moving at all. Any suggestion? @rom1504 |
hi i am new to js can some one tell me how this function works const bot = mineflayer.createBot({ plz help me :( |
also how to use it plz const bot = mineflayer.createBot({ |
Hey ya,
just tried to connect to a server. Heres my code
So .. the login event gets triggerd an im getting output like that:
BOT betritt den Server
Bot is eingeloggt
Nickname
Vec3 { x: 0, y: 0, z: 0 }
But the code in the bot.once('spawn') part never gets execuded.
I've no clue why. I know, that the server is workin with mineflayer. Another user got the bot connected.
Help is appreciated
The text was updated successfully, but these errors were encountered: