Skip to content

Commit

Permalink
fix: handle unsuccessful block breaking packet (eg spawn protection)
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Feb 15, 2025
1 parent 65af9a7 commit 847fed5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/worldInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ class WorldInteraction {
}
})

// Handle acknowledge_player_digging packet
bot._client.on('acknowledge_player_digging', (data: { location: { x: number, y: number, z: number }, block: number, status: number, successful: boolean } | { sequenceId: number }) => {
if ('location' in data && !data.successful) {
const packetPos = new Vec3(data.location.x, data.location.y, data.location.z)
if (this.cursorBlock?.position.equals(packetPos)) {
this.buttons[0] = false
this.update()
this.stopBreakAnimation()
}
}
})

const upLineMaterial = () => {
const inCreative = bot.game.gameMode === 'creative'
const pixelRatio = viewer.renderer.getPixelRatio()
Expand Down

0 comments on commit 847fed5

Please sign in to comment.