Path: blob/master/test/externalTests/rayTrace.js
9427 views
const assert = require('assert')1const { BlockFace } = require('prismarine-world').iterators23module.exports = () => async (bot) => {4const { position } = bot.entity5await bot.lookAt(position.offset(0, 3, 0), true)67let block = bot.blockAtCursor()8assert.strictEqual(block, null)910block = bot.blockInSight()11assert.strictEqual(block, undefined)1213await bot.lookAt(position.offset(0, -3, 0), true)1415block = bot.blockAtCursor()16const relBlock = bot.blockAt(position.offset(0, -1, 0))17relBlock.face = BlockFace.TOP1819assert.deepStrictEqual(block.position, relBlock.position)20assert.deepStrictEqual(block.face, relBlock.face)2122block = bot.blockInSight()23assert.deepStrictEqual(block.position, relBlock.position)24assert.deepStrictEqual(block.face, relBlock.face)25}262728