From 9f4debae488a1a8ff98501bdf46da37731307440 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Oct 2023 13:24:31 +0300 Subject: [PATCH 01/32] fix: fix disconnect after death screen --- .eslintrc.json | 1 + src/utils.ts | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 58df91c97..1ade7da39 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "rules": { "space-infix-ops": "error", "no-multi-spaces": "error", + "space-after-function-name": "error", "space-in-parens": [ "error", "never" diff --git a/src/utils.ts b/src/utils.ts index 389970360..f8e32d804 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,11 +25,11 @@ export const toNumber = (val) => { } export const pointerLock = { - get hasPointerLock() { + get hasPointerLock () { return document.pointerLockElement }, justHitEscape: false, - async requestPointerLock() { + async requestPointerLock () { if (document.getElementById('hud').style.display === 'none' || activeModalStack.length || !document.documentElement.requestPointerLock || miscUiState.currentTouch) { return } @@ -68,7 +68,7 @@ window.getScreenRefreshRate = getScreenRefreshRate /** * Allows to obtain the estimated Hz of the primary monitor in the system. */ -export async function getScreenRefreshRate(): Promise { +export async function getScreenRefreshRate (): Promise { let requestId = null let callbackTriggered = false let resolve @@ -119,7 +119,7 @@ export const isCypress = () => { } // https://github.com/PrismarineJS/node-minecraft-protocol/blob/cf1f67117d586b5e6e21f0d9602da12e9fcf46b6/src/server/login.js#L170 -function javaUUID(s: string) { +function javaUUID (s: string) { const hash = crypto.createHash('md5') hash.update(s, 'utf8') const buffer = hash.digest() @@ -128,7 +128,7 @@ function javaUUID(s: string) { return buffer } -export function nameToMcOfflineUUID(name) { +export function nameToMcOfflineUUID (name) { return (new UUID(javaUUID('OfflinePlayer:' + name))).toString() } @@ -162,7 +162,6 @@ export const disconnect = async () => { // workaround bot.end doesn't end the socket and emit end event bot.end() } - bot._client.emit('end', 'You left the server') miscUiState.gameLoaded = false } From 4356c0169d89abc33d6f4440ad9dd9536b3ff62c Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Tue, 10 Oct 2023 13:30:13 +0300 Subject: [PATCH 02/32] improve viewport meta for iphones --- index.html | 2 +- prismarine-viewer/playground.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index b1e108c95..c81891b8b 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,7 @@ - + diff --git a/prismarine-viewer/playground.html b/prismarine-viewer/playground.html index dfd2d701c..231bca5c3 100644 --- a/prismarine-viewer/playground.html +++ b/prismarine-viewer/playground.html @@ -2,6 +2,7 @@ Prismarine Viewer +