-
Notifications
You must be signed in to change notification settings - Fork 67
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
ability to go through doors, with considerations #325
Conversation
I don't think this is suppose to be the case. Doors should be treated as solid blocks at the moment.
Full stop should only apply when the bot stops and should not be used when trying to path somewhere. A better Approach is to place a node inside of the door the bot can follow. How I would do it is to change the coordinate of the node the bot should walk towards. This function mineflayer-pathfinder/index.js Line 168 in 367205e
If you have a door at position For figuring out in what direction the door is opened you might be able to use the block properties. https://github.com/PrismarineJS/prismarine-block/blob/master/doc/API.md#blockgetproperties this should give you the direction the door is in and if it is opened or closed. This should make it easier to get the door state across different versions instead of having to map the block stateId. |
For opening doors I would use something like the existing fence gate code. Basically add a new entry to a moves toPlace array with the position of the fence gate. In the protocol interacting with a block is just sending a block place packet anyway. But I would focus on being able to walk through already opened doors first and worry about opening doors alter on. |
Okay, I understand now, I had doubts in my ways and didn't really fully understand how path-finding completely works, thank you for this great clarification and advices |
Is there any progress on this PR being merged into master? I think it would be pretty useful. |
this PR is not done yet, it doesn't provide complete functionality, I have been quite busy lately but hopefully will finish it. |
hi @letschill want to have another look here? |
I don’t know mate I’ve been busy with major stuff lately |
The previous person who made this change has never came back to it. This pull request brings back that feature with a lot more. continuation of #84
There is still work to do and currently I got no idea how to implement it.
dilemma
When the door is open, sometimes the bot get stuck and unable to move, this is because an open door is treated like air block, there need to be a function specifically for going through doors.
That function will specifically tell the bot to go the opposite direction of the door's occupied space, so it doesn't collide it.
the free space that an open door has depend on the direction and the facing of the door. but generally the length of that space is 0.0212 block only, which is a small number to get through, this needs accurate calculations.
The pathfinder sometimes has the ability to go through it with no problems, thanks to the fullStop function that centers the bot exactly in the middle of the block.
empty spaces can start like this:
[0.0488 -> 0.0700] or [0.0300 -> 0.0512]
Those numbers are always like that, which one is present depends on the facing and the direction of the door.