#77 Closed
Schematic preview: load schematics off the render thread with a small cache
#enhancement
Problem: SchematicPreviewRenderer.getOrLoadLevel reads and parses the NBT file on the render thread, so the game hitches when a schematic is clicked. It caches only one schematic, and the Schematic Detail screen shares that one slot.
Scope
- Read the file and the NBT in the background, then build the
SchematicLeveland the material list on the main thread once loading finishes. - While it loads, the preview shows a loading indicator.
- Keep an LRU cache of the last few schematics (for example 4), keyed by filename or the
loadFromNbtByteskey. - Never tessellate block models in the background. The known crash in the background ghost renderer (
ByteBufferBuilder.resize) came from exactly that.
Acceptance
- Clicking a large schematic causes no visible frame hitch.
- Switching between recently viewed schematics is instant.
- A broken file shows an error text instead of crashing or showing nothing.
- The cache is cleared when the planner and detail screens close.