Update index.js (#25)

This commit is contained in:
ShrimpyStuff 2021-03-01 13:50:56 -05:00 committed by GitHub
parent 6cc708775e
commit 3471c284e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,11 +119,12 @@ async function main () {
}
}, false)
document.addEventListener('mousedown', (e) => {
let ButtonBlock
if (bot.canDigBlock(bot.blockAtCursor())) ButtonBlock = bot.blockAtCursor()
const ButtonBlock = bot.blockAtCursor()
if (!ButtonBlock) return
if (e.button === 0) {
bot.dig(ButtonBlock)
if (bot.canDigBlock(ButtonBlock)) {
bot.dig(ButtonBlock)
}
} else if (e.button === 2) {
const vecArray = [new Vec3(0, -1, 0), new Vec3(0, 1, 0), new Vec3(0, 0, -1), new Vec3(0, 0, 1), new Vec3(-1, 0, 0), new Vec3(1, 0, 0)]
const vec = vecArray[ButtonBlock.face]