From bd19f85b19a8c598340a56be6e8ad25f84887c69 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Tue, 26 Sep 2023 19:43:04 +0300 Subject: [PATCH] dont crash on mousedown --- src/controls.ts | 1 + src/globals.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controls.ts b/src/controls.ts index 3ca9a329b..8b887736c 100644 --- a/src/controls.ts +++ b/src/controls.ts @@ -320,6 +320,7 @@ const toggleFly = () => { } // #endregion addEventListener('mousedown', (e) => { + if (!bot) return // wheel click // todo support ctrl+wheel (+nbt) if (e.button === 1) { diff --git a/src/globals.d.ts b/src/globals.d.ts index d1d5543a1..79918e939 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -1,7 +1,7 @@ /// declare const THREE: typeof import('three') -// todo +// todo make optional declare const bot: import('mineflayer').Bot declare const viewer: import('../prismarine-viewer/viewer/lib/viewer').Viewer | undefined declare const worldView: import('../prismarine-viewer/viewer/lib/worldView').WorldView | undefined