Skip to content

Cache missing texture metadata and use the default player-head texture - #347

Merged
InventivetalentDev merged 3 commits into
mainfrom
fix/missing-asset-caching
Oct 21, 2026
Merged

InventivetalentDev merged 3 commits into
mainfrom
fix/missing-asset-caching

Conversation

@InventivetalentDev

@InventivetalentDev InventivetalentDev commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

What

Missing texture metadata and entity textures are cached, and placed player heads load one default texture instead of probing for one.

  • Missing results: Caching.MISSING (false) is stored in place of a missing asset. ModelTextures.getMeta stores it in memory and in the persistent metadata cache; Entities.resolveTexture stores it in memory. Both still return undefined to callers.
  • Directory list: with only the vanilla source active (AssetLoader.persistentScope === ""), getMeta reads the hosted _list.json of the texture's directory first and skips the .mcmeta request when the file is not listed. When the list is missing or fails to load, and for added sources such as resource packs, it requests the file as before.
  • Player heads: a placed minecraft:player_head part without a textureLocation uses PlayerHeadTextures' default skin, entity/player/slim/steve, the texture vanilla returns from DefaultPlayerSkin.getDefaultSkin(). Profiles in block-entity data are not read.
  • Imports: BlockObject loads PlayerHeadTextures on first use, so block consumers don't bundle the skin code.
  • Block entity placement: BlockObject.createBlockEntities places each entity right after it is added, so earlier parts no longer sit at the origin while later parts load.

Why

The in-memory loading caches drop undefined results, and PersistentCache.getOrLoad never stores them, so every lookup of a missing .mcmeta or entity texture sent the request again. Most block textures have no .mcmeta, and each placed player head probed about four texture paths that do not exist. A small structure with six heads produced 30 404 responses.

Risk

Medium. Caching.textureMetaCache and Caching.entityTextureCache now hold T | false. TypeScript callers that read these public caches directly must handle false. A wrong entry in a hosted _list.json would hide that texture's animation until the in-memory and persistent caches are cleared.

Dependencies

Testing

  • yarn workspace minerender typecheck, yarn build:lib: pass.
  • yarn test: 836 tests pass, including the new TextureMeta.test.ts (memory and persistent miss caching, list skip, listed file, failed list falls back to the file, added source skips the list), single probes in EntityLoading.test.ts, and the slim/steve key and placement order in BlockEntities.test.ts.
  • yarn build:embed, then yarn test:embed:browser: 7 tests pass. yarn test:embed: 15 tests pass. The browser test's asset fixtures now serve the block texture directory's _list.json, because the test rejects every request it has no fixture for.
  • Placed a 20×2×2 structure with six player heads in Node against the live asset CDN (1.21.11), together with Load structure assets concurrently in world placement #344, Configure the section worker URL and warn when it fails to start #345, and Write Node persistent caches without node-persist's write queue #346: 404 responses went from 30 to 0, and requests for a cold run from 73 to 45.

Note

AI-assisted.

…fault player-head texture

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added library Public minerender package (packages/minerender) fix Bug fix (fix/ branches) labels Oct 21, 2026
@InventivetalentDev
InventivetalentDev marked this pull request as ready for review October 21, 2026 19:13
…ead textures lazily, serve the embed test list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added apps Any app under apps/ embed Iframe embed page (apps/embed) labels Oct 21, 2026
@InventivetalentDev
InventivetalentDev merged commit 8f832a2 into main Oct 21, 2026
3 checks passed
@InventivetalentDev
InventivetalentDev deleted the fix/missing-asset-caching branch October 21, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps Any app under apps/ embed Iframe embed page (apps/embed) fix Bug fix (fix/ branches) library Public minerender package (packages/minerender)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant