From c025a1c75a158a85b4bfc8656ffccc84ae28e36e Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 5 Apr 2025 18:55:59 +0300 Subject: [PATCH] fix a lot annoying sentry errors --- renderer/viewer/lib/mesher/mesher.ts | 4 ++-- src/inventoryWindows.ts | 6 +++++- src/react/MinimapProvider.tsx | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/renderer/viewer/lib/mesher/mesher.ts b/renderer/viewer/lib/mesher/mesher.ts index ed595fd5..21e2d8ef 100644 --- a/renderer/viewer/lib/mesher/mesher.ts +++ b/renderer/viewer/lib/mesher/mesher.ts @@ -122,12 +122,12 @@ const handleMessage = data => { case 'blockUpdate': { const loc = new Vec3(data.pos.x, data.pos.y, data.pos.z).floored() if (data.stateId !== undefined && data.stateId !== null) { - world.setBlockStateId(loc, data.stateId) + world?.setBlockStateId(loc, data.stateId) } const chunkKey = `${Math.floor(loc.x / 16) * 16},${Math.floor(loc.z / 16) * 16}` if (data.customBlockModels) { - world.customBlockModels.set(chunkKey, data.customBlockModels) + world?.customBlockModels.set(chunkKey, data.customBlockModels) } break } diff --git a/src/inventoryWindows.ts b/src/inventoryWindows.ts index 7b5cd951..40b0e4d7 100644 --- a/src/inventoryWindows.ts +++ b/src/inventoryWindows.ts @@ -275,7 +275,7 @@ const mapSlots = (slots: Array, isJei = false) => { if (!isJei) { const oldKey = lastMappedSlots[i]?.cacheKey const newKey = itemToVisualKey(slot) - slot['cacheKey'] = newKey + slot['cacheKey'] = i + '|' + newKey if (oldKey && oldKey === newKey) { return lastMappedSlots[i] } @@ -478,6 +478,10 @@ const openWindow = (type: string | undefined) => { } } lastWindow.pwindow.onJeiClick = (slotItem, _index, isRightclick) => { + if (versionToNumber(bot.version) < versionToNumber('1.13')) { + alert('Item give is broken on 1.12.2 and below, we are working on it!') + return + } // slotItem is the slot from mapSlots const itemId = loadedData.itemsByName[slotItem.name]?.id if (!itemId) { diff --git a/src/react/MinimapProvider.tsx b/src/react/MinimapProvider.tsx index fcd23f97..0e9cd943 100644 --- a/src/react/MinimapProvider.tsx +++ b/src/react/MinimapProvider.tsx @@ -80,8 +80,13 @@ export class DrawerAdapterImpl extends TypedEventEmitter implements const readZ = chunkZ % 32 < 0 ? 32 + chunkZ % 32 : chunkZ % 32 console.log('heightmap check begun', readX, readZ) void this.regions.get(regionKey)?.read(readX, readZ)?.then((rawChunk) => { - const chunk = simplify(rawChunk as any) - const heightmap = findHeightMap(chunk) + let heightmap: number[] | undefined + try { + const chunk = simplify(rawChunk as any) + heightmap = findHeightMap(chunk) + } catch (err) { + console.warn('error getting heightmap', err) + } if (heightmap) { this.isBuiltinHeightmapAvailable = true this.loadChunkFullmap = this.loadChunkFromRegion