diff --git a/src/integratedServer/main.ts b/src/integratedServer/main.ts index 0d65ae2a2..1c1735333 100644 --- a/src/integratedServer/main.ts +++ b/src/integratedServer/main.ts @@ -56,10 +56,13 @@ export const updateLocalServerSettings = (settings: Partial) export const startLocalServerMain = async (serverOptions: { version: any }) => { worker = new Worker('./integratedServer.js') serverChannel = useWorkerProxy(worker, true) - const readyPromise = new Promise(resolve => { + const readyPromise = new Promise((resolve, reject) => { addEventListener('ready', () => { resolve() }) + worker!.addEventListener('error', (err) => { + reject(err.error ?? 'Unknown error with the worker, check that integratedServer.js could be loaded from the server') + }) }) serverChannel.start({ @@ -77,6 +80,9 @@ export const startLocalServerMain = async (serverOptions: { version: any }) => { addEventListener('packet', (data) => { restorePatchedDataDeep(data) processData(data) + if (data.name === 'map_chunk') { + addStatPerSec('map_chunk') + } }) }, options.excludeCommunicationDebugEvents) setupEvents() diff --git a/src/integratedServer/worker.ts b/src/integratedServer/worker.ts index a24b079d7..fb2cdd2a1 100644 --- a/src/integratedServer/worker.ts +++ b/src/integratedServer/worker.ts @@ -13,7 +13,7 @@ export interface CustomAppSettings { export interface BackEvents { ready: {} quit: {} - packet: {} + packet: any otherPlayerPacket: { player: string packet: any