minecraft-renderer 0.1.55 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,6 +69,17 @@ export const loadThreeJsTextureFromBitmap = (image: ImageBitmap) => {
69
69
  return texture
70
70
  }
71
71
 
72
+ /** Worker-safe sync handle; image loads via fetch + OffscreenCanvas (not TextureLoader). */
73
+ export function loadNearestFilterTexture (imageUrl: string): THREE.Texture {
74
+ const { texture, promise } = loadThreeJsTextureFromUrlSync(imageUrl)
75
+ texture.magFilter = THREE.NearestFilter
76
+ texture.minFilter = THREE.NearestFilter
77
+ void promise.catch((err) => {
78
+ console.error('[texture] failed to load', imageUrl, err)
79
+ })
80
+ return texture
81
+ }
82
+
72
83
  export async function loadTexture (texture: string, cb: (texture: THREE.Texture) => void, onLoad?: () => void): Promise<void> {
73
84
  const cached = textureCache[texture]
74
85
  if (!cached) {
@@ -11,6 +11,7 @@ import { Vec3 } from 'vec3'
11
11
  import TypedEmitter from 'typed-emitter'
12
12
  import type { WorldViewEvents, ChunkPosKey, WorldSizeParams } from './types'
13
13
  import { generateSpiralMatrix } from '../lib/spiral'
14
+ import { sanitizeWorkerEventArgs } from '../lib/workerMessageSanitize'
14
15
 
15
16
  /**
16
17
  * Helper to calculate chunk position from absolute position.
@@ -131,7 +132,7 @@ export class WorldView extends (EventEmitter as new () => TypedEmitter<WorldView
131
132
  class: WorldViewWorker.restorerName,
132
133
  type: 'event',
133
134
  eventName,
134
- args,
135
+ args: sanitizeWorkerEventArgs(args),
135
136
  })
136
137
  }) as any
137
138
  }