PrismarineJS / mineflayer

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

Add acknowledge_player_digging packet handler #1555

Open introquest opened 3 years ago

introquest commented 3 years ago

Problem

After writing packet play.block_dig we always read packet play.acknowledge_player_digging but don't process it at all. *Reproduced on minecraft versions 1.14.4, 1.16.3, 1.16.4 with forge version 34.1.0

Possible solution

Add handler for acknowledge_player_digging like:

bot._client.on('acknowledge_player_digging', (packet) => {
...
}

But it's not clear to me which handler is expected (((

Additional context

This issue stable reproduce on remote server(standalone server). So i got "successful": false all time then connect to server, like:

  minecraft-protocol read packet play.acknowledge_player_digging +17ms
  minecraft-protocol {
  minecraft-protocol   "location": {
  minecraft-protocol     "x": 8,
  minecraft-protocol     "z": 133,
  minecraft-protocol     "y": 63
  minecraft-protocol   },
  minecraft-protocol   "block": 9,
  minecraft-protocol   "status": 0,
  minecraft-protocol   "successful": false
  minecraft-protocol } +0ms

But i got "successful": true all time then connect to "Open to LAN" server(started from another client), like:

  minecraft-protocol read packet play.acknowledge_player_digging +1ms
  minecraft-protocol {
  minecraft-protocol   "location": {
  minecraft-protocol     "x": 204,
  minecraft-protocol     "z": 102,
  minecraft-protocol     "y": 61
  minecraft-protocol   },
  minecraft-protocol   "block": 9,
  minecraft-protocol   "status": 0,
  minecraft-protocol   "successful": true
  minecraft-protocol } +0ms
Saiv46 commented 2 years ago

This works in Badlion, but not in Prismarine Viewer.

I suddenly had a thought, and broke blocks, moved away to trigger a chunk unload, and moved back. The blocks had magically reappeared. So the digging is not saved or taking effect in Flying Squid, but it is in PV.

I then ran two PV web pages next to each other. The second player does not see the broken blocks. But ... the first player can break blocks and walk into the gap that is made. The second player then sees this: embedded

So it's a PV problem (plus possibly a FS one).

Originally posted by @kf106 in https://github.com/PrismarineJS/flying-squid/issues/595#issuecomment-1155638443

Saiv46 commented 2 years ago

@rom1504 Please requalify this issue as a bug, not new feature