fix a lot annoying sentry errors

This commit is contained in:
Vitaly Turovsky 2025-04-05 18:55:59 +03:00
commit c025a1c75a
3 changed files with 14 additions and 5 deletions

View file

@ -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
}

View file

@ -275,7 +275,7 @@ const mapSlots = (slots: Array<RenderItem | Item | null>, 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) {

View file

@ -80,8 +80,13 @@ export class DrawerAdapterImpl extends TypedEventEmitter<MapUpdates> 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