Skip to content

Commit

Permalink
[to pick pr] fix ray trace!
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Dec 12, 2024
1 parent 58ce991 commit 293d8b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/plugins/ray_trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ module.exports = (bot) => {

bot.blockAtEntityCursor = (entity = bot.entity, maxDistance = 256, matcher = null) => {
if (!entity.position || !entity.height || !entity.pitch || !entity.yaw) return null
const { position, height, pitch, yaw } = entity
let { position, eyeHeight, pitch, yaw } = entity

const eyePosition = position.offset(0, height, 0)
if (bot.controlState.sneak) eyeHeight -= 0.3

const eyePosition = position.offset(0, eyeHeight, 0)
const viewDirection = getViewDirection(pitch, yaw)

return bot.world.raycast(eyePosition, viewDirection, maxDistance, matcher)
Expand Down

0 comments on commit 293d8b9

Please sign in to comment.