PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

Bot can't move in y=256 or 255 #1153

Closed slonkazoid closed 4 years ago

slonkazoid commented 4 years ago

[X] The FAQ doesn't contain a resolution to my issue

Versions

Detailed description of a problem

Bot thinks that it is surrounded by blocks in y=256 or 255.

So it cannot move.

Expected behavior

Bot should move normally

Additional context

Works perfectly in other ground: https://streamable.com/ud7kgn

Can't move in y=255 or 256 https://streamable.com/myfeqy

(sorry for the item names. I didn't name them.)

TheDudeFromCI commented 4 years ago

I think this is related to blocks outside of the world bounds being considered undefined, and not being handled properly.

Karang commented 4 years ago

Not undefined, bedrock: https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/blocks.js#L190 (just remove the line) I fixed it some time ago https://github.com/PrismarineJS/mineflayer/pull/1022 but had to revert the changes (don't remember why)

Karang commented 4 years ago

Ah got it, is was needed to also fix https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/1.13/ChunkColumn.js#L50 (for all versions), because the section is undefined (not null).

IdanHo commented 4 years ago

would the proper fix be to detect out of bounds y levels (< 0 || > 255) and return an air block on the mineflayer layer or the prismarine-chunk layer then?

Karang commented 4 years ago

In prismarine-chunk https://github.com/PrismarineJS/prismarine-chunk/pull/95 Once merged we can remove https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/blocks.js#L190

slonkazoid commented 4 years ago

I guess this is done