diff --git a/src/index.ts b/src/index.ts index b3c04d8c..c0721cc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -776,7 +776,7 @@ export async function connect (connectOptions: ConnectOptions) { playerState.onlineMode = !!connectOptions.authenticatedAccount setLoadingScreenStatus('Placing blocks (starting viewer)') - if (connectOptions.worldStateFileContents && connectOptions.worldStateFileContents.length < 3 * 1024 * 1024) { + if (!connectOptions.worldStateFileContents || connectOptions.worldStateFileContents.length < 3 * 1024 * 1024) { localStorage.lastConnectOptions = JSON.stringify(connectOptions) } connectOptions.onSuccessfulPlay?.() diff --git a/src/sounds/botSoundSystem.ts b/src/sounds/botSoundSystem.ts index 059f7e65..8a22082e 100644 --- a/src/sounds/botSoundSystem.ts +++ b/src/sounds/botSoundSystem.ts @@ -107,16 +107,16 @@ subscribeKey(miscUiState, 'gameLoaded', async () => { await playHardcodedSound(soundId, position, volume, pitch) }) - bot.on('hardcodedSoundEffectHeard', async (soundIdNum, soundCategory, position, volume, pitch) => { - const soundKey = soundMap!.soundsIdToName[soundIdNum] - if (soundKey === undefined) return - await playGeneralSound(soundKey, position, volume, pitch) - }) - bot._client.on('sound_effect', async (packet) => { const soundResource = packet['soundEvent']?.resource as string | undefined - if (packet.soundId !== 0 || !soundResource) return const pos = new Vec3(packet.x / 8, packet.y / 8, packet.z / 8) + if (packet.soundId !== 0 || !soundResource) { + const soundKey = soundMap!.soundsIdToName[packet.soundId] + if (soundKey === undefined) return + await playGeneralSound(soundKey, pos, packet.volume, packet.pitch) + return + } + await playHardcodedSound(soundResource.replace('minecraft:', ''), pos, packet.volume, packet.pitch) })