PrefabRenderer:Asset Sources

From MutigerAffe Wiki
Jump to navigation Jump to search

To draw a block, Prefab Renderer needs its item definition, its textures and, for model blocks, its .blockymodel file. It looks for them in one or more asset sources. Each source has the Hytale asset layout:

Server/Item/Items/...   item and block definitions (*.json)
Common/...              textures (*.png) and models (*.blockymodel)

The three kinds of sources

Vanilla assets: Assets.zip

The vanilla blocks come from the Assets.zip that the Hytale launcher installs. The path is set with hytalePrefabViewer.assetsZip.

  • The archive is read in place. It is never extracted and nothing is copied.
  • When it is opened, only its table of contents is read. After that the extension reads single files as a prefab needs them.
  • The archive stays open and is shared by all 3D views until the assets are reloaded.
  • The default path is the location of the Flatpak launcher on Linux. On other systems, set the path yourself.

Detected mod folder

With hytalePrefabViewer.detectAssetFolder on (the default), the extension walks up from the folder of the opened prefab and uses the nearest folder that contains Server/Item/Items. For a mod checkout this is usually src/main/resources, so a prefab in src/main/resources/Server/Prefabs/... picks up the mod's own blocks without any configuration.

Detection only works for files on the local file system.

Configured asset folders

hytalePrefabViewer.assetFolders is a list of extra asset folders, for example the resources folder of another mod your prefab uses. Use it when the prefab does not lie inside the mod's resources folder:

"hytalePrefabViewer.assetFolders": ["/home/me/code/repos/BetterBiomes/src/main/resources"]

Search order

For every file the sources are searched in this order. The first source that has the file wins:

  1. the detected mod folder
  2. the configured asset folders, in the order of the list
  3. Assets.zip

So a mod folder can override a vanilla block or texture, and a mod block can still use vanilla textures and models. The order used by a view is shown under Asset sources in the sidebar.

Paths

  • ~ at the start of a path is replaced with your home folder.
  • A relative path is resolved against the first workspace folder.
  • If hytalePrefabViewer.assetsZip is empty, the default path is used.
  • Empty entries in hytalePrefabViewer.assetFolders are ignored.

If a configured folder does not exist, the sidebar shows the warning Asset folder not found. If Assets.zip cannot be opened, it shows Vanilla assets not available with the reason. The view still renders: blocks that cannot be found are drawn magenta.

Caching and reloading

Item definitions, models and textures are cached. The list of item files in a mod folder is also built once. This makes repeated renders fast, but it also means that changes to the asset files themselves are not picked up on their own.

  • After you change textures, models or block definitions in a mod folder, or add new block files, press Reload assets in the sidebar.
  • Changing one of the extension's settings has the same effect: all caches are dropped and every open 3D view is redrawn.
  • Edits to the prefab are always shown live. They do not need a reload.

Supported archives

The built-in zip reader handles stored and deflate-compressed entries and ZIP64 archives, which covers the launcher's Assets.zip. Other compression methods cause an error for that file.

Prefab Renderer
Start Installation · Using the 3D View
Features Rendering · Asset Sources
Reference Commands and Settings · FAQ and Troubleshooting · Version History
Links Project page on mutigeraffe.com · Download on the VS Code Marketplace